/**
 * Public styles for Table Builder plugin.
 */

/* Wrapper */
.table-builder-wrapper {
	margin: 20px 0;
	clear: both;
}

/* Responsive wrapper */
.table-builder-responsive-wrapper {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

/* Base table styles */
.table-builder-table {
	width: 100%;
	border-collapse: collapse;
	background: #fff;
	font-size: 14px;
	line-height: 1.6;
}

.table-builder-table th,
.table-builder-table td {
	padding: 12px 15px;
	text-align: left;
	vertical-align: top;
}

/* Header styles */
.table-builder-table thead th {
	color: #212529;
	font-weight: 600;
	border-bottom: 2px solid #dee2e6;
}

/* Bordered variant */
.table-builder-table.bordered {
	border: 1px solid #dee2e6;
}

.table-builder-table.bordered th,
.table-builder-table.bordered td {
	border: 1px solid #dee2e6;
}

/* Striped variant - only apply if no custom row colors */
.table-builder-table.striped tbody tr:nth-child(odd):not([style*="background-color"]) {
	background: #f9f9f9;
}

.table-builder-table.striped tbody tr:nth-child(even):not([style*="background-color"]) {
	background: #fff;
}

/* Hover effect - only for rows without custom colors */
.table-builder-table tbody tr:not([style*="background-color"]):hover {
	background: #f5f5f5;
}

/* Images in cells */
.table-builder-table img {
	max-width: 100%;
	height: auto;
	display: block;
	margin: 10px 0;
}

/* Clickable images */
.table-builder-table a img {
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.table-builder-table a img:hover {
	opacity: 0.85;
	transform: scale(1.02);
}

/* Buy Now button styles */
.table-builder-buy-btn {
	display: inline-block;
	padding: 10px 20px;
	background: #28a745;
	color: #fff !important;
	text-decoration: none !important;
	border-radius: 4px;
	font-weight: 600;
	text-align: center;
	transition: all 0.3s ease;
	margin: 5px 0;
	border: none;
}

.table-builder-buy-btn:hover {
	opacity: 0.9;
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.table-builder-buy-btn:active {
	transform: translateY(0);
	box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

/* Text formatting in cells */
.table-builder-table strong {
	font-weight: 700;
}

.table-builder-table em {
	font-style: italic;
}

/* Text alignment */
.table-builder-table [style*="text-align"] {
	display: block;
}

/* Multi-line text support */
.table-builder-table td,
.table-builder-table th {
	white-space: pre-wrap;
	word-wrap: break-word;
}

/* Inline text styling support */
.table-builder-table span[style*="color"],
.table-builder-table span[style*="background-color"],
.table-builder-table span[style*="font-size"] {
	display: inline;
}

/* Links in tables */
.table-builder-table a {
	color: #007bff;
	text-decoration: none;
}

.table-builder-table a:hover {
	text-decoration: underline;
}

/* Image links - no underline */
.table-builder-table a img {
	border: none;
	text-decoration: none;
}

/* Error message */
.table-builder-error {
	padding: 15px;
	background: #f8d7da;
	border: 1px solid #f5c6cb;
	color: #721c24;
	border-radius: 4px;
	margin: 20px 0;
}

/* Responsive behavior */
@media screen and (max-width: 768px) {
	.table-builder-table {
		font-size: 13px;
	}
	
	.table-builder-table th,
	.table-builder-table td {
		padding: 10px 12px;
	}

	.table-builder-buy-btn {
		padding: 8px 16px;
		font-size: 13px;
	}
}

@media screen and (max-width: 480px) {
	.table-builder-table {
		font-size: 12px;
	}
	
	.table-builder-table th,
	.table-builder-table td {
		padding: 8px 10px;
	}

	.table-builder-buy-btn {
		display: block;
		width: 100%;
		padding: 10px;
		font-size: 14px;
	}
}

/* Print styles */
@media print {
	.table-builder-table {
		border: 1px solid #000;
	}
	
	.table-builder-table th,
	.table-builder-table td {
		border: 1px solid #000;
	}
	
	.table-builder-table thead th {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.table-builder-table tbody tr[style*="background-color"],
	.table-builder-table tbody td[style*="background-color"] {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}

	.table-builder-buy-btn {
		-webkit-print-color-adjust: exact;
		print-color-adjust: exact;
	}
	
	/* Show link URLs after clickable images in print */
	.table-builder-table a[href]:after {
		content: " (" attr(href) ")";
		font-size: 0.8em;
		font-style: italic;
	}
	
	/* Don't show URLs for image-only links */
	.table-builder-table a img:after {
		content: none;
	}
}

