/**
 * Gold Price Table Styles
 * Modern, responsive styling for gold price display
 */

/* Container */
.gold-price-container {
    background: #fff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    border: 1px solid #d1d5db;
}

/* Header */
.gold-price-header {
    background: linear-gradient(135deg, #fdbf30, #f59e0b);
    color: #000;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.gold-price-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: #000;
}

.gold-price-update {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}

.update-time {
    font-size: 0.875rem;
    font-weight: 500;
    color: #000;
}

.data-status {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 12px;
    font-weight: 600;
}

.data-status.fresh {
    background: rgba(34, 197, 94, 0.2);
    color: #15803d;
}

.data-status.stale {
    background: rgba(245, 158, 11, 0.2);
    color: #d97706;
}

/* Table Wrapper */
.gold-price-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Table */
.gold-price-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    background: #fff;
}

.gold-price-table thead {
    background: #f8fafc;
    border-bottom: 3px solid #d1d5db;
}

.gold-price-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 700;
    color: #374151;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #d1d5db;
    border-right: 1px solid #d1d5db;
}

.gold-price-table th:nth-child(3),
.gold-price-table th:nth-child(4) {
    text-align: right;
}

/* Remove right border from last column */
.gold-price-table th:last-child,
.gold-price-table td:last-child {
    border-right: none;
}

.gold-price-table tbody tr {
    border-bottom: 1px solid #d1d5db;
    transition: background-color 0.2s ease;
}

.gold-price-table tbody tr:hover {
    background: #f9fafb;
}

.gold-price-table tbody tr:last-child {
    border-bottom: none;
}

.gold-price-table td {
    padding: 14px 12px;
    color: #374151;
    vertical-align: middle;
    border-right: 1px solid #d1d5db;
}

/* Region column */
.gold-price-table .region {
    font-weight: 600;
    color: #1f2937;
    min-width: 120px;
}

/* Company column */
.gold-price-table .company {
    font-weight: 500;
    color: #4b5563;
    min-width: 140px;
}

/* Price columns */
.gold-price-table .buy-price,
.gold-price-table .sell-price {
    text-align: right;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    min-width: 100px;
}

.gold-price-table .buy-price {
    color: #dc2626;
}

.gold-price-table .sell-price {
    color: #059669;
}

/* Footer */
.gold-price-footer {
    padding: 16px 20px;
    background: #f8fafc;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.gold-price-footer small {
    color: #6b7280;
    font-size: 0.75rem;
}

.gold-price-footer a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
}

.gold-price-footer a:hover {
    text-decoration: underline;
}

/* Widget Styles */
.gold-price-widget {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
}

.gold-price-widget h4 {
    margin: 0 0 16px 0;
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    border-bottom: 2px solid #fdbf30;
    padding-bottom: 8px;
}

.price-stats {
    display: grid;
    gap: 12px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.stat-item:last-child {
    border-bottom: none;
}

.stat-item .label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.stat-item .value {
    font-size: 0.875rem;
    font-weight: 700;
    color: #1f2937;
    font-family: 'Courier New', monospace;
}

.widget-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.widget-footer small {
    color: #9ca3af;
    font-size: 0.75rem;
}

/* Error State */
.gold-price-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

/* Loading State */
.gold-price-loading {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
}

.gold-price-loading::before {
    content: "⏳ ";
    margin-right: 8px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .gold-price-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .gold-price-header h3 {
        font-size: 1.25rem;
    }
    
    .gold-price-update {
        align-items: flex-start;
        width: 100%;
    }
    
    .gold-price-table {
        font-size: 0.8rem;
    }
    
    .gold-price-table th,
    .gold-price-table td {
        padding: 10px 8px;
    }
    
    .gold-price-table .region,
    .gold-price-table .company {
        min-width: 80px;
    }
    
    .gold-price-table .buy-price,
    .gold-price-table .sell-price {
        min-width: 80px;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .gold-price-container {
        margin: 10px 0;
    }
    
    .gold-price-header {
        padding: 16px;
    }
    
    .gold-price-header h3 {
        font-size: 1.125rem;
    }
    
    .gold-price-table {
        font-size: 0.75rem;
    }
    
    .gold-price-table th,
    .gold-price-table td {
        padding: 8px 6px;
    }
    
    .gold-price-footer {
        padding: 12px 16px;
    }
    
    .gold-price-widget {
        padding: 16px;
    }
    
    .price-stats {
        gap: 8px;
    }
    
    .stat-item {
        padding: 6px 0;
    }
}

/* Print Styles */
@media print {
    .gold-price-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .gold-price-header {
        background: #f5f5f5 !important;
        color: #000 !important;
    }
    
    .data-status {
        display: none;
    }
    
    .gold-price-table tbody tr:hover {
        background: transparent;
    }
    
    .gold-price-footer a {
        color: #000;
        text-decoration: underline;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .gold-price-header {
        background: #000;
        color: #fff;
    }
    
    .gold-price-table th {
        background: #f0f0f0;
        border: 1px solid #000;
    }
    
    .gold-price-table td {
        border: 1px solid #666;
    }
    
    .gold-price-table .buy-price {
        color: #000;
        font-weight: 900;
    }
    
    .gold-price-table .sell-price {
        color: #000;
        font-weight: 900;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .gold-price-table tbody tr {
        transition: none;
    }
    
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
