/**
 * Gold Price Fetcher - Frontend CSS
 * Complete rewrite for clean table and card layouts
 */

/* ===== TABLE WRAPPER ===== */
.gpf-table-wrapper {
	width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ===== TABLE STRUCTURE ===== */
.gpf-table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	font-size: 15px;
	line-height: 1.5;
}

/* ===== TABLE HEADER ===== */
.gpf-table thead {
	background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
	border-bottom: 2px solid #dee2e6;
}

.gpf-table thead th {
	padding: 14px 16px;
	text-align: left;
	font-weight: 600;
	color: #212529;
	font-size: 14px;
	letter-spacing: 0.3px;
	white-space: nowrap;
	vertical-align: middle;
}

/* Header bilingual content */
.gpf-th-content {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.gpf-th-primary {
	font-weight: 600;
	color: #212529;
	font-size: 14px;
}

.gpf-th-secondary {
	font-weight: 400;
	color: #6c757d;
	font-size: 12px;
}

/* Header specific columns */
.gpf-th-category { width: 35%; }
.gpf-th-purity { width: 15%; }
.gpf-th-price { width: 17%; text-align: right; }
.gpf-th-change { width: 16%; text-align: right; }

/* ===== TABLE BODY ===== */
.gpf-table tbody tr {
	border-bottom: 1px solid #f1f3f5;
	transition: background-color 0.15s ease;
}

.gpf-table tbody tr:last-child {
	border-bottom: none;
}

.gpf-table tbody tr:hover {
	background-color: #f8f9fa;
}

.gpf-table tbody td {
	padding: 14px 16px;
	vertical-align: middle;
	color: #495057;
}

/* Cell bilingual content */
.gpf-td-content {
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.gpf-td-primary {
	font-weight: 500;
	color: #212529;
	font-size: 15px;
}

.gpf-td-secondary {
	font-weight: 400;
	color: #868e96;
	font-size: 13px;
}

/* Specific cell types */
.gpf-td-category {
	font-weight: 500;
}

.gpf-td-price,
.gpf-td-change {
	text-align: right;
	font-feature-settings: "tnum";
	font-variant-numeric: tabular-nums;
}

.gpf-td-price .gpf-td-content,
.gpf-td-change .gpf-td-content {
	align-items: flex-end;
}

/* ===== TABLE FOOTER ===== */
.gpf-table-footer {
	padding: 12px 16px;
	text-align: center;
	background: #f8f9fa;
	border-top: 1px solid #e9ecef;
	color: #6c757d;
	font-size: 12px;
	border-radius: 0 0 8px 8px;
}

/* ===== RESPONSIVE: MOBILE STACKED LAYOUT ===== */
@media (max-width: 768px) {
	.gpf-table-wrapper {
		box-shadow: none;
		border-radius: 0;
	}

	.gpf-table {
		font-size: 14px;
	}

	/* Hide header on mobile */
	.gpf-table thead {
		display: none;
	}

	/* Stack rows as cards */
	.gpf-table tbody {
		display: block;
	}

	.gpf-table tbody tr {
		display: block;
		margin-bottom: 16px;
		border: 1px solid #e9ecef;
		border-radius: 8px;
		background: #fff;
		box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
		padding: 12px;
	}

	.gpf-table tbody tr:hover {
		background: #fff;
	}

	.gpf-table tbody td {
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		padding: 10px 0;
		border-bottom: 1px solid #f1f3f5;
		text-align: left;
	}

	.gpf-table tbody td:last-child {
		border-bottom: none;
	}

	/* Add label before each cell */
	.gpf-table tbody td::before {
		content: attr(data-label);
		font-weight: 600;
		color: #6c757d;
		font-size: 13px;
		min-width: 100px;
		flex-shrink: 0;
	}

	/* Right-align price cells on mobile */
	.gpf-td-price,
	.gpf-td-change {
		text-align: right;
	}

	.gpf-td-content {
		text-align: right;
	}
}

@media (max-width: 480px) {
	.gpf-table {
		font-size: 13px;
	}

	.gpf-table tbody tr {
		padding: 10px;
		margin-bottom: 12px;
	}

	.gpf-table tbody td {
		padding: 8px 0;
	}

	.gpf-table tbody td::before {
		font-size: 12px;
		min-width: 90px;
	}

	.gpf-td-primary {
		font-size: 14px;
	}

	.gpf-td-secondary {
		font-size: 12px;
	}
}

/* Card Layout Styles */
.gpf-card-layout {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 20px;
}

.gpf-card {
	padding: 20px;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
	transition: transform 0.2s, box-shadow 0.2s;
}

.gpf-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.gpf-card h3 {
	margin: 0 0 15px 0;
	font-size: 18px;
	color: #333;
}

.gpf-card-details {
	list-style: none;
	margin: 0;
	padding: 0;
}

.gpf-card-details li {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 8px 0;
	border-bottom: 1px solid #f0f0f0;
	gap: 12px;
}

.gpf-card-details li:last-child {
	border-bottom: none;
}

.gpf-card .gpf-label { 
	color: #666; 
	font-size: 13px; 
}

.gpf-card .gpf-value { 
	font-weight: 600; 
	color: #222; 
}

.gpf-card .gpf-value .gpf-english { 
	color: #666; 
	font-weight: 400; 
	font-size: 0.95em; 
}

.gpf-card .gpf-label.gpf-bilingual { 
	display: flex; 
	flex-direction: column; 
	align-items: flex-start; 
}

.gpf-card .gpf-value.gpf-bilingual { 
	text-align: right; 
	align-items: flex-end; 
	display: flex; 
	flex-direction: column; 
}

/* Responsive card adjustments */
@media (max-width: 768px) {
	.gpf-card-layout {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.gpf-card {
		padding: 12px;
	}

	.gpf-card h3 {
		font-size: 15px;
		margin-bottom: 8px;
	}

	.gpf-card-details li { 
		padding: 6px 0; 
	}
}

/* ===== FALLBACK & UTILITY CLASSES ===== */
.gpf-fallback {
	padding: 20px;
	text-align: center;
	background-color: #fff3cd;
	border: 1px solid #ffc107;
	border-radius: 4px;
	color: #856404;
}

.gpf-text-center { text-align: center; }
.gpf-text-right { text-align: right; }
.gpf-font-bold { font-weight: bold; }
.gpf-text-muted { color: #999; }

/* Bilingual display helpers (legacy support) */
.gpf-bilingual {
	display: flex;
	flex-direction: column;
}

.gpf-bilingual .gpf-bengali {
	font-weight: 600;
	line-height: 1.1;
}

.gpf-bilingual .gpf-english {
	font-size: 0.9em;
	color: #666;
	margin-top: 4px;
}

.gpf-card .gpf-bilingual { 
	margin-bottom: 6px; 
}

/* Legacy last update (for backward compatibility) */
.gpf-last-update {
	margin-top: 20px;
	text-align: center;
	color: #999;
	font-size: 12px;
}
