/* ============================================================
   mobile.css — Moohin Mobile Responsive Overrides
   Loaded after custom.css, gold-index.css, sidebar.css
   ============================================================ */

/* ── Mobile Yearly Accordion (Home page) ───────────────────── */
#mobileYearlyAccordion .accordion-button {
    color: #fff !important;
}
#mobileYearlyAccordion .accordion-button::after {
    filter: brightness(0) invert(1); /* white chevron on gold background */
}
#mobileYearlyAccordion .accordion-button:not(.collapsed) {
    background: linear-gradient(135deg, #daa520 0%, #b8860b 100%) !important;
    box-shadow: none !important;
}
#mobileYearlyAccordion .accordion-body {
    background: #fffdf5;
}

/* ── Mobile Quick Navigation Chips ─────────────────────────── */
.mobile-quick-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 0.5rem 0.25rem;
    -webkit-overflow-scrolling: touch;
}

.mobile-quick-nav::-webkit-scrollbar {
    display: none;
}

.mobile-quick-nav .nav-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    padding: 0.45rem 0.9rem;
    border-radius: 50px;
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    background: linear-gradient(135deg, #fffdf5 0%, #fef3c7 100%);
    color: #85652d;
    border: 1px solid rgba(212, 175, 55, 0.35);
    box-shadow: 0 1px 3px rgba(212, 175, 55, 0.15);
    transition: all 0.2s ease;
    min-height: 36px;
}

.mobile-quick-nav .nav-chip:hover,
.mobile-quick-nav .nav-chip.active {
    background: linear-gradient(135deg, #D4AF37 0%, #85652D 100%);
    color: #fff;
    border-color: #D4AF37;
    box-shadow: 0 2px 6px rgba(212, 175, 55, 0.35);
    text-decoration: none;
}

.mobile-quick-nav .nav-chip i {
    font-size: 0.78rem;
}

/* Quick nav wrapper */
.mobile-quick-nav-wrapper {
    background: rgba(255, 253, 245, 0.9);
    border-bottom: 1px solid rgba(212, 175, 55, 0.15);
    padding: 0 0.75rem;
}

/* ── Sticky Gold Bar — Mobile ────────────────────────────────── */
@media (max-width: 576px) {
    #sticky-gold-bar {
        font-size: 0.72rem !important;
    }
    #sticky-gold-bar .sticky-bar-track > div {
        padding: 3px 8px !important;
        gap: 0 !important;
    }
}

/* ── Navbar — Mobile ─────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .navbar {
        padding: 0.625rem 0.875rem !important;
    }
    .navbar-brand {
        font-size: 1.2rem !important;
    }
    /* Collapsed menu items on mobile */
    .navbar-collapse .nav-link {
        min-height: 48px !important;
        padding: 0.75rem 1rem !important;
        border-radius: 6px;
        margin: 0.125rem 0;
    }
    .navbar-toggler {
        padding: 0.35rem 0.6rem;
        min-height: 40px;
        min-width: 40px;
    }
}

/* ── Gold Price Banner — Remove on Mobile ───────────────────── */
@media (max-width: 991.98px) {
    .gold-price-time-banner {
        display: none !important;
    }
}

/* ── Cards — Mobile ─────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .card {
        border-radius: 10px !important;
        margin-bottom: 1rem !important;
    }
    .card-header {
        padding: 0.75rem 1rem !important;
    }
    .card-header h5 {
        font-size: 0.95rem !important;
        margin: 0 !important;
        line-height: 1.4;
    }
    .card-body {
        padding: 1rem !important;
    }
}

/* ── Typography — Mobile ─────────────────────────────────────── */
@media (max-width: 767.98px) {
    h1, .h1 { font-size: 1.6rem !important; }
    h2, .h2 { font-size: 1.35rem !important; }
    h3, .h3 { font-size: 1.15rem !important; }
    h4, .h4 { font-size: 1.05rem !important; }
    /* Minimum readable body text */
    body { font-size: 14px !important; }
}

@media (max-width: 575.98px) {
    h1, .h1 { font-size: 1.4rem !important; }
    h2, .h2 { font-size: 1.2rem !important; }
    .display-5 { font-size: 1.35rem !important; }
}

/* ── Tables — Mobile: ensure minimum 13px, never below 12px ─── */
@media (max-width: 767.98px) {
    .table-gold,
    .table-gold th,
    .table-gold td {
        font-size: 0.8rem !important; /* 12.8px — minimum readable */
    }
    .table-gold th,
    .table-gold td {
        padding: 0.45rem 0.35rem !important;
    }
}

@media (max-width: 575.98px) {
    .table-gold,
    .table-gold th,
    .table-gold td {
        font-size: 0.78rem !important; /* ~12.5px */
    }
    .table-gold th,
    .table-gold td {
        padding: 0.35rem 0.25rem !important;
    }
}

/* ── Daily Price Card Layout (mobile) ──────────────────────── */
/* Hide full table on xs; show card list */
@media (max-width: 575.98px) {
    .daily-table-desktop { display: none !important; }
    .daily-cards-mobile  { display: block !important; }
}
@media (min-width: 576px) {
    .daily-table-desktop { display: block !important; }
    .daily-cards-mobile  { display: none !important; }
}

.daily-price-card {
    background: #fff;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.625rem;
    box-shadow: 0 1px 4px rgba(212, 175, 55, 0.1);
}

.daily-price-card .dpc-date {
    font-size: 0.82rem;
    font-weight: 600;
    color: #85652d;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.daily-price-card .dpc-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.375rem;
}

.daily-price-card .dpc-item {
    background: #fffdf5;
    border-radius: 6px;
    padding: 0.375rem 0.5rem;
    font-size: 0.78rem;
}

.daily-price-card .dpc-item .label {
    color: #888;
    font-size: 0.72rem;
    margin-bottom: 0.1rem;
}

.daily-price-card .dpc-item .value {
    font-weight: 600;
    font-size: 0.85rem;
}

.daily-price-card .dpc-item .value.buy  { color: #059669; }
.daily-price-card .dpc-item .value.sell { color: #dc2626; }

.daily-price-card .dpc-meta {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: #888;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* ── Historical Page — Mobile ─────────────────────────────────── */
@media (max-width: 767.98px) {
    /* Ensure minimum readable size for updates table */
    .table-gold th,
    .table-gold td {
        font-size: 0.78rem !important;
        padding: 0.35rem 0.3rem !important;
    }
    /* Collapse/expand button more tappable */
    .btn-outline-gold[data-bs-toggle="collapse"] {
        min-height: 40px;
        min-width: 40px;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
    /* Smaller heading on historical page */
    .display-5.fw-bold {
        font-size: 1.4rem !important;
    }
}

/* ── Footer — Mobile ─────────────────────────────────────────── */
@media (max-width: 767.98px) {
    .footer {
        padding: 2rem 0 1.25rem !important;
    }
    .footer .row > [class*="col-"] {
        margin-bottom: 1.5rem;
    }
    .footer .row > [class*="col-"]:last-child {
        margin-bottom: 0;
        text-align: left !important;
    }
    .footer h5 {
        font-size: 1rem;
        border-bottom: 1px solid rgba(255,255,255,0.1);
        padding-bottom: 0.5rem;
        margin-bottom: 0.75rem;
    }
    .footer ul li {
        margin-bottom: 0.625rem;
    }
    .footer ul li a {
        min-height: 36px;
        display: inline-flex;
        align-items: center;
    }
}

/* ── Buttons — Touch Targets ─────────────────────────────────── */
@media (max-width: 767.98px) {
    /* All general buttons at least 44px tall */
    .btn:not(.btn-sm):not(.navbar-toggler) {
        min-height: 44px;
    }
    /* Small buttons at least 36px */
    .btn-sm {
        min-height: 36px;
        display: inline-flex !important;
        align-items: center;
    }
    /* Pagination */
    .mobile-pagination .btn {
        min-height: 44px !important;
    }
}

/* ── Back to Top — Mobile ────────────────────────────────────── */
@media (max-width: 767.98px) {
    .back-to-top-btn {
        width: 40px;
        height: 40px;
        bottom: 20px;
        right: 16px;
        border-radius: 50%;
    }
}

/* ── Home page hero price table — Mobile ─────────────────────── */
@media (max-width: 575.98px) {
    /* Price table in hero area */
    .card-body.p-0 .table-gold td,
    .card-body.p-0 .table-gold th {
        font-size: 0.82rem !important;
        padding: 0.5rem 0.35rem !important;
    }
    .card-body.p-0 .table-gold span[style*="font-size: 1.05rem"],
    .card-body.p-0 .table-gold strong {
        font-size: 0.9rem !important;
    }
    /* Price change badge */
    .card-body.p-0 .badge {
        font-size: 0.72rem !important;
        padding: 0.2rem 0.45rem !important;
    }
    /* Gold type image in table */
    .card-body.p-0 .table-gold img {
        width: 15px !important;
    }
    /* Association logo */
    .card-body.p-0 .table-gold thead img[alt*="สมาคม"] {
        width: 30px !important;
        height: 30px !important;
    }
    .card-body.p-0 .table-gold thead span {
        font-size: 0.78rem !important;
    }
    /* Footer timestamp row */
    .card-body.p-0 .table-gold tfoot td {
        font-size: 0.72rem !important;
        line-height: 1.5;
    }
}

/* ── Breadcrumb — Mobile ─────────────────────────────────────── */
@media (max-width: 575.98px) {
    .breadcrumb {
        font-size: 0.78rem !important;
        flex-wrap: nowrap;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* ── Market updates section header — Mobile ──────────────────── */
@media (max-width: 767.98px) {
    .card-header .d-flex.justify-content-between {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* ── Container spacing on small screens ──────────────────────── */
@media (max-width: 575.98px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}
