/* ==========================================================================
   static/css/gold_style.css
   Cleaned & Optimized Version
   ========================================================================== */

/* --- 1. BASE STYLES & LAYOUT --- */
.gold-dashboard-wrapper {
    margin: 20px 0;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.gold-card {
    background: #6bd2df;
    border-radius: 15px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    padding: 20px;
    border: 1px solid #eee;
    overflow: hidden;
}

/* --- 2. NAVIGATION & HEADERS --- */
.top-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    gap: 15px;
    flex-wrap: wrap;
}

.gold-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f8f9fa;
    padding-bottom: 15px;
}

.gold-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #b8860b; 
}

.gold-title h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.table-header, .table-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 15px;
}

/* --- 3. BUTTONS & ACTIONS --- */
.btn-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-actions a {
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    cursor: pointer;
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-back-custom {
    background: linear-gradient(135deg, #87CEEB, #B0E0E6);
    color: #333;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 100, 200, 0.2);
}

.btn-back-custom:hover {
    background: linear-gradient(135deg, #B0E0E6, #87CEEB);
    color: #000;
    box-shadow: 0 4px 8px rgba(0, 100, 200, 0.3);
    transform: translateY(-2px);
}

.btn-update-gold {
    background: linear-gradient(135deg, #FF69B4, #FF1493);
    color: white;
    border: none;
    box-shadow: 0 2px 4px rgba(255, 20, 147, 0.3);
}

.btn-update-gold:hover {
    background: linear-gradient(135deg, #FF1493, #FF69B4);
    box-shadow: 0 4px 8px rgba(255, 20, 147, 0.4);
    transform: translateY(-2px);
}

.btn-excel-gold {
    background: linear-gradient(135deg, #90EE90, #32CD32);
    color: #333;
    border: none;
    box-shadow: 0 2px 4px rgba(50, 205, 50, 0.3);
}

.btn-excel-gold:hover {
    background: linear-gradient(135deg, #32CD32, #90EE90);
    color: #000;
    box-shadow: 0 4px 8px rgba(50, 205, 50, 0.4);
    transform: translateY(-2px);
}

/* Focus and active states for accessibility */
.btn-back-custom:focus,
.btn-update-gold:focus,
.btn-excel-gold:focus {
    outline: 2px solid rgba(0,0,0,0.2);
    outline-offset: 2px;
}

.btn-back-custom:active,
.btn-update-gold:active,
.btn-excel-gold:active {
    transform: translateY(0);
}

/* Remove the generic hover effect from parent */
/* --- 4. SUMMARY BOXES (Antam & Pegadaian) --- */
.summary-container {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.summary-box {
    width: 150px;
    padding: 6px 8px;
    border-radius: 10px;
    text-align: center;
    color: white;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.summary-box h4 {
    margin: 0;
    font-size: 0.7rem;
    opacity: 0.9;
    font-weight: 500;
    text-transform: uppercase;
}

.summary-box p {
    margin: 3px 0 0 0;
    font-size: 1.1rem;
    font-weight: bold;
}

/* Summary Box Variants */
.gold, .gold-summary {
    background: linear-gradient(135deg, #d4af37, #f1c40f);
    border-bottom: 4px solid #b8860b;
}

.green, .green-summary {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    border-bottom: 4px solid #1e8449;
}

/* --- 5. GRID & ITEM CARDS --- */
.gold-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.gold-item {
    background: linear-gradient(135deg, #ffffff 0%, #fdfbf0 100%);
    border: 1px solid #f1e6b2;
    padding: 15px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s ease;
}

.gold-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(184, 134, 11, 0.1);
}

.gold-icon {
    background: #b8860b;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
}

.gold-info .label {
    font-size: 0.85rem;
    color: #666;
    font-weight: 600;
    display: block;
}

.gold-info .value {
    font-size: 1.15rem;
    color: #222;
    font-weight: 800;
    margin-top: 2px;
}

.pajak-badge {
    background: #fff8e1;
    color: #ff8f00;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: bold;
    border: 1px solid #ffe082;
}

/* --- 6. CHART & STATUSES --- */
.chart-container {
    height: 400px;
    position: relative;
}

.avg-item.green {
    background-color: #28a745 !important;
    color: white !important;
}

.avg-item.red {
    background-color: #dc3545 !important;
    color: white !important;
}

.avg-item.green strong, .avg-item.green span,
.avg-item.red strong, .avg-item.red span {
    color: white !important;
}

/* --- 7. FOOTER & RESPONSIVE --- */
.gold-footer {
    margin-top: 15px;
    text-align: right;
    color: #999;
}

@media (max-width: 600px) {
    .gold-header, .top-navigation, .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .summary-container {
        justify-content: center;
        width: 100%;
    }
}

.update-text {
    text-align: center;
    margin-top: 12px;
    color: #555; /* Warna teks abu-abu gelap */
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px; /* Jarak antara ikon jam dan teks */
}

.update-text i {
    color: #00529C; /* Warna biru untuk ikon jam */
}

.gold-chart-container {
    position: relative;
    height: 100px; /* 🔥 Batasi tinggi kontainer 🔥 */
    width: 100%;
    margin-bottom: 20px;
}
/* 🔥 PAKSA KONTAINER GRAFIK MENJADI KECIL 🔥 */
.chart-container {                
    height: 220px !important;  /* Batas tinggi mutlak */
    max-height: 220px !important;
    overflow: hidden;         /* Sembunyikan bagian yang meluap */
    padding: 0 !important;
    margin-bottom: 10px !important;
}

/* 🔥 PAKSA CANVAS MENGIKUTI KONTAINER 🔥 */
#goldChart {
    height: 100% !important;
    width: 100% !important;
}

/* =========================================
   CSS untuk Merapatkan Jarak (Fix Spacing)
   ========================================= */

/* 1. Tombol Button ke atas (Zero Gap) */
.table-header {                
    margin-top: 0 !important;   /* Menghilangkan jarak di atas tombol */
    margin-bottom: 10px !important; /* Mengurangi jarak antara tombol dan grafik */
    padding-top: 0 !important;
}

/* 2. Dekatkan kontener/kanvas grafik ke button */
.card {
    margin-top: 0 !important;   /* Menghilangkan margin atas kartu grafik */
    padding-top: 15px !important; /* Mengurangi padding dalam kartu grafik */
}

/* 3. Menghilangkan margin bawah tombol aksi jika perlu */
.btn-actions {
    margin-bottom: 0 !important;
}
/* --- PERBAIKAN KHUSUS DASHBOARD EMAS (AMAN) --- */

/* 1. Paksa teks ANTAM/G24 menyesuaikan lebar */
#gold-dashboard-unique .currency-value {
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Gunakan vw agar responsif */
    font-size: 1.5vw;
}

/* 2. Paksa item AVERAGE menyesuaikan lebar */
#gold-dashboard-unique .avg-item {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2px;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
}

/* 3. Paksa angka AVERAGE menyesuaikan lebar */
#gold-dashboard-unique .avg-item strong {
    display: block;
    width: 100%;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Lebih kecil dari font utama */
    font-size: 0.9vw;
}

/* 4. Media Query: Aturan khusus untuk layar HP */
@media (max-width: 768px) {
    #gold-dashboard-unique .currency-value {
        font-size: 16px; /* Ukuran tetap untuk layar kecil */
    }
    #gold-dashboard-unique .avg-item strong {
        font-size: 11px; /* Ukuran tetap untuk layar kecil */
    }
}