/**
 * Gold Price Homepage Styles - Optimized
 * Styles for gold price table on homepage
 */

/* ==========================================================================
   Data Info Bar
   ========================================================================== */
.data-info {
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef) !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.data-info > div:first-child {
    font-weight: 600;
    color: #2c5aa0;
    font-size: 14px;
}

.data-info > div:last-child {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
}

/* ==========================================================================
   Gold Price Table Structure
   ========================================================================== */
.gold-table-scroll {
    max-height: 450px;
    overflow-y: auto;
    border: 1px solid #d1d5db;
    border-top: none;
}

.gold-table-scroll .table {
    margin-bottom: 0;
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}

/* ==========================================================================
   Table Header
   ========================================================================== */
.gold-table-scroll .table thead {
    background: linear-gradient(135deg, #fdbf30, #f59e0b) !important;
    position: sticky;
    top: 0;
    z-index: 10;
}

.gold-table-scroll .table thead th {
    color: white !important;
    font-weight: 600 !important;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    border: 1px solid rgba(255,255,255,0.2) !important;
    padding: 12px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==========================================================================
   Table Body
   ========================================================================== */
.gold-table-scroll .table tbody tr {
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s ease;
}

.gold-table-scroll .table tbody tr:nth-child(even) {
    background: #f9fafb;
}

.gold-table-scroll .table tbody tr:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.gold-table-scroll .table tbody td {
    border-right: 1px solid #e5e7eb;
    vertical-align: middle;
    padding: 12px;
}

.gold-table-scroll .table tbody td:last-child {
    border-right: none;
}

/* ==========================================================================
   Cell Specific Styles
   ========================================================================== */
.gold-region {
    color: #2563eb !important;
    font-weight: 600 !important;
    background: #f8fafc;
    border-right: 2px solid #e5e7eb !important;
    position: relative;
}

.gold-region::after {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #fed751;
}

.gold-company {
    font-weight: 600 !important;
    font-size: 15px !important;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gold-company:hover {
    color: #1d4ed8 !important;
}

.gold-price {
    font-family: 'Courier New', 'Monaco', monospace !important;
    font-weight: 600 !important;
    text-align: right;
    font-size: 13px;
    letter-spacing: 0.5px;
}

.gold-price.buy {
    font-size: 15px;
    font-weight: 600 !important;
    color: #b45309 !important;
    background: rgba(180, 83, 9, 0.05);
}

.gold-price.sell {
    font-size: 15px;
    font-weight: 600 !important;
    color: #059669 !important;
    background: rgba(5, 150, 105, 0.05);
}

/* ==========================================================================
   Custom Scrollbar
   ========================================================================== */
.gold-table-scroll {
    scrollbar-width: thin;
    scrollbar-color: #fdbf30 #f8f9fa;
}

.gold-table-scroll::-webkit-scrollbar {
    width: 8px;
}

.gold-table-scroll::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 4px;
}

.gold-table-scroll::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #fdbf30, #f59e0b);
    border-radius: 4px;
    border: 1px solid #e5e5e5;
}

.gold-table-scroll::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* ==========================================================================
   Loading States
   ========================================================================== */
#gold-loading {
    display: none;
    text-align: center;
    padding: 40px;
    color: #6b7280;
    font-size: 14px;
}

#gold-loading::before {
    content: '⏳';
    display: block;
    font-size: 24px;
    margin-bottom: 10px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */
@media (max-width: 768px) {
    .data-info {
        padding: 12px 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .data-info > div:first-child {
        font-size: 13px;
    }
    
    .data-info > div:last-child {
        font-size: 11px;
    }
    
    .gold-table-scroll {
        max-height: 350px;
    }
    
    .gold-table-scroll .table thead th {
        padding: 8px 6px;
        font-size: 11px;
    }
    
    .gold-table-scroll .table tbody td {
        padding: 8px 6px;
        font-size: 12px;
    }
    
    .gold-price {
        font-size: 12px !important;
    }
}

@media (max-width: 480px) {
    .data-info {
        padding: 10px 12px;
    }
    
    .gold-table-scroll {
        max-height: 300px;
    }
    
    .gold-table-scroll .table thead th {
        padding: 6px 4px;
        font-size: 10px;
    }
    
    .gold-table-scroll .table tbody td {
        padding: 6px 4px;
        font-size: 11px;
    }
    
    .gold-price {
        font-size: 11px !important;
        letter-spacing: 0.3px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
    .gold-table-scroll {
        max-height: none;
        overflow: visible;
        border: 1px solid #000;
    }
    
    .gold-table-scroll .table thead {
        background: #f0f0f0 !important;
    }
    
    .gold-table-scroll .table thead th {
        color: #000 !important;
        text-shadow: none;
        border: 1px solid #000 !important;
    }
    
    .gold-table-scroll .table tbody td {
        border: 1px solid #000;
    }
    
    .gold-region,
    .gold-company {
        color: #000 !important;
    }
    
    .gold-price.buy,
    .gold-price.sell {
        color: #000 !important;
        font-size: 15px;
        font-weight: 600 !important;
        background: none !important;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .gold-table-scroll .table tbody tr {
        transition: none;
    }
    
    .gold-table-scroll .table tbody tr:hover {
        transform: none;
        box-shadow: none;
    }
    
    .gold-company {
        transition: none;
    }
    
    #gold-loading::before {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .gold-region {
        border-right: 3px solid #000 !important;
    }
    
    .gold-region::after {
        background: #000;
        width: 4px;
    }
    
    .gold-table-scroll .table tbody tr:hover {
        background: #e5e5e5;
    }
}
