/* CSS Variables for card-related styles */
:root {
    --card-bg: white;
    --text-dark: #343a40;
    --text-muted: #6c757d;
    --price-green: #28a745;
    --price-red: #dc3545;
    --shadow-light: 0 1px 4px rgba(0, 0, 0, 0.05);
    --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.08);
    --primary-blue: #0d6efd;

    /* Pastel colors for card backgrounds */
    --red-pastel-soft: #ffe8e8; /* Soft red pastel */
    --green-pastel-soft: #e8ffee; /* Soft green pastel */
    --yellow-pastel-soft: #fffacd; /* Soft yellow pastel for zero change */
}

/* Header Ringkasan */
.summary-header {
    background: linear-gradient(135deg, var(--header-gradient-start), var(--header-gradient-end));
    color: white;
    padding: 15px 20px; /* Default padding */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    position: relative;
    z-index: 1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    animation: slideInUp 0.8s ease-out;
    overflow-x: auto; /* Memungkinkan scroll horizontal jika konten terlalu lebar */
    -webkit-overflow-scrolling: touch; /* Untuk scrolling yang lebih halus di iOS */
}

.summary-header .header-top {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.header-center-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    line-height: 1.3;
}

.summary-header .header-title-centered {
    font-size: 1.3em;
    font-weight: 700;
    color: white;
    margin-bottom: 5px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.3);
}

.summary-header .fetch-date-time {
    white-space: nowrap; /* Mencegah teks wrap ke baris baru */
    font-size: 0.95em; /* Ukuran font default untuk tanggal */
    color: rgba(255, 255, 255, 0.8);
    margin-top: 0;
    font-weight: 400;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Daftar Brand (Grid Layout) */
.brand-list {
    padding-top: 0; /* Removed top padding */
    padding-bottom: 0; /* Removed bottom padding */
    padding-left: 10px; /* Keep horizontal padding */
    padding-right: 10px; /* Keep horizontal padding */
    margin: 20px auto;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    width: 100%;
}

/* Reduced gap between cards using g-2 for gutter */
.brand-list.row {
    --bs-gutter-x: 0.5rem; /* ~8px horizontal gutter */
    --bs-gutter-y: 0.5rem; /* ~8px vertical gutter */
}

/* Redesigned Brand Item */
.brand-item {
    display: flex;
    flex-direction: column; /* Changed to column to control height better */
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 15px; /* Reduced vertical padding */
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    height: 150px; /* Fixed height for all cards for uniformity */
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%;
    background-color: var(--card-bg);
    border: 1px solid rgba(0,0,0,0.05);
    position: relative; /* Added for absolute positioning of trend icon */
    overflow: hidden;
}
.brand-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
}

/* Trend Icon Styling */
.trend-icon {
    position: absolute;
    top: 15px; /* Aligned with brand name */
    right: 15px;
    font-size: 1.5em; /* Size of the icon */
    z-index: 2; /* Ensure it's above other content */
}
.trend-icon.red-icon { color: #dc3545; } /* Red for negative */
.trend-icon.green-icon { color: #28a745; } /* Green for positive */
.trend-icon.yellow-icon { color: #ffc107; } /* Yellow for zero */


/* Specific style for GOLD SPOT card wrapper */
.gold-spot-card-wrapper {
    width: 100%;
    padding: 0 15px;
    margin: 20px auto;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Custom style for GOLD SPOT card */
.gold-spot-card {
    background: linear-gradient(145deg, #FFD700, #DAA520); /* Gold gradient */
    border: 3px solid #B8860B; /* Darker gold border */
    box-shadow: 0 10px 30px rgba(0,0,0,0.4); /* Stronger shadow */
    color: #333; /* Darker text color for contrast on gold */
    height: 150px; /* Fixed height */
    padding: 12px 15px; /* Consistent padding */
    display: flex;
    flex-direction: column; /* Stack content vertically */
    align-items: flex-start;
    justify-content: space-between;
    width: 100%; /* Default to full width */
}

/* Adjust text colors within GOLD SPOT card for contrast */
.gold-spot-card .brand-name,
.gold-spot-card .value-label,
.gold-spot-card .value-data {
    color: #333; /* Ensure all text is dark for contrast */
}
.gold-spot-card .value-data.jual-color {
    color: #28a745; /* Green for dark text */
}
.gold-spot-card .value-data.beli-color {
    color: #0d6efd; /* Blue for dark text */
}
.gold-spot-card .value-data.red {
    color: #dc3545; /* Red for dark text */
}
.gold-spot-card .value-data.green {
    color: #28a745; /* Green for dark text */
}
.gold-spot-card .trend-icon.red-icon { color: #dc3545; }
.gold-spot-card .trend-icon.green-icon { color: #28a745; }
.gold-spot-card .trend-icon.yellow-icon { color: #555; } /* Darker yellow/grey for zero change */

/* Media queries for GOLD SPOT card width and centering */
@media (min-width: 768px) { /* Tablet and Desktop */
    .gold-spot-card-wrapper {
        max-width: 700px; /* Max width for tablet and desktop */
        margin: 20px auto; /* Center align */
    }
}
@media (min-width: 992px) { /* Desktop */
    .gold-spot-card-wrapper {
        max-width: 800px; /* Slightly wider for desktop */
    }
}


/* New style for "Harga Emas Dunia" badge */
.gold-spot-world-price-badge {
    background-color: #0d6efd; /* Blue color */
    color: white;
    font-size: 0.75em;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 5px;
    margin-left: 8px;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Conditional Card Backgrounds - More vibrant */
.brand-item.red-pastel-soft {
    background: linear-gradient(135deg, #ffe8e8, #ffcaca); /* Soft red gradient */
}
.brand-item.green-pastel-soft {
    background: linear-gradient(135deg, #e8ffee, #caffd9); /* Soft green gradient */
}
.brand-item.yellow-pastel-soft {
    background: linear-gradient(135deg, #fffacd, #fff5b3); /* Soft yellow gradient */
}

.brand-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: auto; /* Allow width to be determined by content */
    flex-grow: 1; /* Allow it to take available space */
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex-shrink: 1; /* Allow shrinking if space is limited */
    gap: 10px; /* Add gap between logo and text for better spacing */
}
.brand-logo {
    width: 50px; /* Increased size */
    height: 50px; /* Increased size */
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    background-color: #cccccc; /* Default background if no image */
    display: flex; /* Added for centering content */
    align-items: center; /* Added for vertical centering */
    /* Removed justify-content: center; to allow flex-grow on brand-text to push it */
    color: #ffffff;
    font-weight: bold;
    font-size: 1.5em; /* Adjusted font size for larger logo */
    flex-shrink: 0;
}
.brand-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: contain; /* Use contain to ensure full logo is visible */
}
.brand-text {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    overflow: hidden;
    flex-grow: 1;
    min-width: 0; /* Allow text to shrink and ellipsis to work correctly */
}
.brand-name {
    font-size: 1.1em;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* Removed width: 100%; as it can conflict with flex-grow and min-width */
}

.badge-jenis {
    font-size: 0.7em;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 5px;
    margin-top: 4px;
    white-space: nowrap;
    display: inline-block;
    color: white;
    box-shadow: none;
}
.badge-digital {
    background-color: #673ab7;
}
.badge-physical {
    background-color: #ff9800;
}
.badge-world-gold { /* New class for "Harga Emas Dunia" badge */
    background-color: #0d6efd; /* Blue color */
}

/* Corrected .details-right for all cards */
.details-right {
    display: flex;
    flex-direction: row; /* Arrange items in a row */
    align-items: flex-start; /* Align items to the start of the cross-axis */
    flex-shrink: 0;
    font-size: 0.9em;
    padding-top: 0;
    padding-bottom: 0;
    border-top: none;
    gap: 15px; /* Horizontal gap between data items */
    width: auto; /* Let content define width */
    margin-top: auto; /* Push to bottom if parent is column */
    margin-left: auto; /* Push to right if parent is row */
    justify-content: flex-end; /* Align content to the right within its space */
}

/* Styles for individual data items within rows */
.data-item {
    display: flex;
    flex-direction: column; /* Stacks label and value */
    align-items: flex-start; /* Align label and value to the left */
    margin-left: 0;
    min-width: 50px; /* Ensures minimum width for each data block */
    flex-shrink: 0; /* Prevent shrinking */
}

.value-label {
    font-size: 0.7em;
    color: var(--text-muted);
    font-weight: 400;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.value-data {
    font-size: 1em;
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
}
.value-data.price {
    font-size: 1.1em;
    font-weight: 700;
}
.value-data.jual-color {
    color: #388e3c;
}
.value-data.beli-color {
    color: #1976d2;
}
.value-data.red {
    color: #d32f2f;
}
.value-data.green {
    color: #388e3c;
}

/* Error Message */
.error-message {
    color: var(--price-red);
    font-weight: bold;
    text-align: center;
    margin-top: 20px;
    padding: 10px;
    background-color: #ffe8e8;
    border-radius: 8px;
    border: 1px solid var(--price-red);
    max-width: 800px;
    margin: 20px auto;
}

/* Redesigned Global Footer Style - No curves */
footer {
    width: 100%;
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d); /* Matching header gradient */
    color: white;
    padding: 25px 0;
    margin-top: 60px; /* More space from content */
    border-top-left-radius: 0; /* Removed curve */
    border-top-right-radius: 0; /* Removed curve */
    box-shadow: 0 -8px 20px rgba(0,0,0,0.3);
    text-align: center;
    animation: fadeInUp 1s ease-out;
}
.footer-content {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}
.footer-title {
    font-size: 1.5em;
    font-weight: 700;
    margin-bottom: 10px;
    color: #FFD700; /* Gold color */
}
.footer-links a {
    color: white;
    text-decoration: none;
    margin: 0 10px;
    font-size: 0.9em;
    transition: color 0.3s ease;
}
.footer-links a:hover {
    color: #FFD700; /* Gold on hover */
}
.social-icons a {
    color: white;
    font-size: 1.2em;
    margin: 0 8px;
    transition: transform 0.3s ease, color 0.3s ease;
}
.social-icons a:hover {
    transform: translateY(-3px);
    color: #FFD700;
}
.copyright-text {
    font-size: 0.8em;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 15px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Responsive adjustments for columns */
/* Default: 1 column on extra small devices (xs, below 576px) -> col-12 */
/* Small devices (sm, 576px and up): 2 columns -> col-sm-6 */
/* Medium devices (md, 768px and up): 3 columns -> col-md-4 */
/* Large devices (lg, 992px and up): 4 columns -> col-lg-3 */
@media (min-width: 992px) {
    .brand-list .col-lg-3 {
        flex: 0 0 auto;
        width: 25%;
    }
}
@media (min-width: 768px) and (max-width: 991.98px) {
    .brand-list .col-md-4 {
        flex: 0 0 auto;
        width: 33.333333%;
    }
}
@media (min-width: 576px) and (max-width: 767.98px) {
    .brand-list .col-sm-6 {
        flex: 0 0 auto;
        width: 50%;
    }
}
@media (max-width: 575.98px) {
    .brand-list .col-12 {
        flex: 0 0 auto;
        width: 100%;
    }
}

/* Media queries for dynamic summary-header padding */
@media (max-width: 768px) {
    .summary-header {
        padding: 15px 5vw; /* More dynamic horizontal padding on smaller screens */
    }
}
@media (max-width: 576px) {
    .summary-header .header-title-centered {
        font-size: 1.1em;
    }
    .summary-header .fetch-date-time {
        font-size: 0.75em;
    }
}
