/* ============================================================
   GoldRateEgypt.com theme: clean modern light
   Loaded last (after style.css, template/style.css, calculator.css),
   so it overrides the older base styles.
   ============================================================ */

:root {
    --bg: #f4f5f7;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --border: #e4e7ec;
    --border-strong: #d0d5dd;
    --text: #18212f;
    --muted: #5d6878;
    --gold: #c9971c;          /* accent fills, bars, focus rings */
    --gold-soft: #fbf4e2;     /* tinted backgrounds */
    --gold-text: #7d5a00;     /* gold-coloured text, AA on white */
    --up: #0b7a43;
    --up-bg: #e6f5ec;
    --down: #c0262d;
    --down-bg: #fdeceb;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --font: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, 'Noto Sans Arabic', Arial, sans-serif;
}

/* ---------- Base ---------- */
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

body.menu-open {
    overflow: hidden;
}

a {
    color: var(--gold-text);
    text-decoration: none;
}

a:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
}

:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
    border-radius: 4px;
}

h1 {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: .25rem;
}

h2,
.h2 {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.4;
    border-bottom: 0;
    padding-bottom: 0;
    margin-bottom: .85rem;
}

h2::before,
.h2::before {
    content: "";
    flex: 0 0 4px;
    height: 1.15em;
    border-radius: 4px;
    background: var(--gold);
}

h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

strong,
b {
    font-weight: 700;
}

.skip-link {
    position: absolute;
    inset-inline-start: 1rem;
    top: -100px;
    z-index: 100;
    background: var(--text);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: var(--radius-sm);
}

.skip-link:focus {
    top: 1rem;
    color: #fff;
}

/* ---------- Header ---------- */
.header {
    background: var(--surface);
    padding-bottom: 0;
}

.header nav.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 0 1rem;
    background: rgba(255, 255, 255, .92);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}

.nav-container {
    max-width: 1170px;
    height: 68px;
    gap: 1.5rem;
}

.logo {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
}

.logo:hover {
    text-decoration: none;
}

.logo img {
    height: 46px;
    width: auto;
}

.nav-links {
    flex: 1 1 auto;
    gap: .25rem;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: block;
    padding: .45rem .8rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-weight: 500;
    font-size: .95rem;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.nav-links a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.nav-links a.active {
    background: var(--gold-soft);
    color: var(--gold-text);
    font-weight: 600;
}

.topbar-end {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.live {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .25rem .75rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}

.live::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--up);
    box-shadow: 0 0 0 3px rgba(11, 122, 67, .15);
}

.live.live-down::before {
    background: var(--down);
    box-shadow: 0 0 0 3px rgba(192, 38, 45, .15);
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: var(--text);
}

@media (max-width: 991.98px) {
    .nav-links {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    .nav-container {
        height: 60px;
    }

    .logo img {
        height: 40px;
    }
}

/* Mobile drawer (RTL: slides in from the right) */
.nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(16, 24, 40, .35);
}

.nav-sidebar {
    z-index: 50;
    width: 280px;
    right: -300px;
    margin: 0;
    padding: 1.25rem 1rem;
    background: var(--surface);
    box-shadow: -8px 0 24px rgba(16, 24, 40, .12);
    overflow-y: auto;
}

.nav-sidebar.active {
    right: 0;
}

.nav-sidebar a {
    padding: .7rem .9rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
}

.nav-sidebar a:hover {
    background: var(--surface-2);
    text-decoration: none;
}

.nav-sidebar a.active {
    background: var(--gold-soft);
    color: var(--gold-text);
    font-weight: 600;
}

/* ---------- Price ticker (header_bar) ---------- */
.ticker {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .5rem 1rem .9rem;
}

.market {
    height: auto;
    margin: 0 0 .5rem;
    font-size: .8rem;
}

.market .status {
    font-weight: 600;
}

.countdown {
    color: var(--muted);
    font-size: .8rem;
}

.open {
    color: var(--up);
}

.closed {
    color: var(--down);
}

.header-bar {
    gap: .6rem;
    padding: 2px;
}

.header-bar-item {
    flex: 0 0 176px;
    height: auto;
    min-height: 0;
    padding: .7rem .75rem .6rem;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background-color: var(--surface-2);
    background-size: 16px auto;
    background-position: right 10px top 10px, right 30px top 10px;
}

.header-bar .header-bar-item-main .currency-unit {
    font-size: .78rem;
    font-weight: 600;
    color: var(--muted);
    margin: 0 0 .15rem;
    padding-inline-start: 2.6rem;
    text-align: start;
    white-space: nowrap;
}

.header-bar .header-bar-item-main .main-rate {
    margin: 0;
}

.header-bar .header-bar-item-main .large {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0;
    font-variant-numeric: tabular-nums;
}

.header-bar .meta-rates {
    height: auto;
    font-size: .8rem;
    font-weight: 600;
}

.header-bar .meta-rates2 {
    font-size: .7rem;
    color: var(--muted);
    direction: ltr;
}

.up-arrow,
.down-arrow {
    border-left-width: 5px;
    border-right-width: 5px;
    margin-bottom: 2px;
}

.up-arrow {
    border-bottom: 6px solid var(--up);
}

.down-arrow {
    border-top: 6px solid var(--down);
}

.scroll-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    font-size: 1rem;
    line-height: 34px;
    border-radius: 50%;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* ---------- Layout ---------- */
.container {
    background: transparent;
    border-radius: 0;
    margin-top: 1.25rem;
    margin-bottom: 1.5rem;
    padding: 0 15px;
}

.col-md-8 > .section,
.col-md-8 > section,
.col-md-12 > .section,
.col-md-12 > section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.4rem;
    margin: 0 0 1rem;
}

.col-md-8 > .section,
.col-md-8 > section {
    min-width: 0;
    overflow-x: auto;      /* wide tables scroll inside their card, not the page */
}

.col-md-8 > .section > :last-child,
.col-md-8 > section > :last-child {
    margin-bottom: 0;
}

.date {
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: 1rem;
}

.lead-text {
    color: var(--muted);
    font-size: .92rem;
    line-height: 1.9;
    margin: 0 .25rem 1rem;
}

/* Older pages still use .lead-price */
.lead-price {
    font-size: 1.05rem;
    line-height: 2;
}

.lead-price .big {
    font-size: 1.35rem;
    font-weight: 700;
    padding: 1px 10px;
    border-radius: 8px;
}

.lead-price .update,
.update {
    display: block;
    font-size: .82rem;
    color: var(--muted);
}

/* ---------- Home hero ---------- */
.col-md-8 > .hero {
    padding: 0;
    overflow: hidden;
}

.hero-main {
    padding: 1.4rem 1.5rem 1.25rem;
    background: linear-gradient(180deg, var(--gold-soft) 0%, var(--surface) 100%);
    border-bottom: 1px solid var(--border);
}

.hero-label {
    font-size: 1rem;
    color: var(--muted);
}

.hero-label strong {
    color: var(--text);
}

.hero-price {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    margin: .1rem 0 .5rem;
}

.hero-value {
    font-size: clamp(2.5rem, 7vw, 3.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
}

.hero-unit {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--muted);
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    margin-bottom: .6rem;
}

.hero-buy {
    color: var(--muted);
}

.hero-buy strong {
    color: var(--text);
}

.hero-update {
    margin-bottom: .5rem;
}

.hero-link {
    font-weight: 600;
    font-size: .92rem;
}

.hero .price-card-sell {
    font-size: 1.2rem;
}

.price-card-sell,
.price-card-change {
    white-space: nowrap;
}

.hero .price-cards {
    margin: 0;
    padding: 1rem 1.25rem 1.25rem;
}

/* ---------- Price change pills ---------- */
.pill {
    display: inline-block;
    padding: .1rem .6rem;
    border-radius: 999px;
    font-size: .88rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.rising {
    background: var(--up-bg);
    color: var(--up);
}

.falling {
    background: var(--down-bg);
    color: var(--down);
}

.stable {
    background: var(--surface-2);
    color: var(--muted);
}

.green {
    color: var(--up) !important;
}

.red {
    color: var(--down) !important;
}

.black {
    color: var(--muted) !important;
}

/* ---------- Price cards ---------- */
.price-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: .75rem;
    margin: 1rem 0;
}

.price-card {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    padding: .85rem .9rem;
    text-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.price-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow);
}

.price-card.featured {
    border: 1px solid var(--gold);
    background: var(--gold-soft);
}

.price-card-title {
    font-size: .88rem;
    font-weight: 600;
    color: var(--muted);
    margin: 0;
}

.price-card-title a {
    color: inherit;
}

.price-card-sell {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    font-variant-numeric: tabular-nums;
}

.price-card-sell small {
    font-size: .75rem;
    font-weight: 500;
    color: var(--muted);
}

.price-card-row {
    font-size: .82rem;
    color: var(--muted);
}

.price-card-row strong {
    color: var(--text);
    font-weight: 600;
}

.price-card-change {
    align-self: flex-start;
    margin-top: .35rem;
    padding: .05rem .5rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    direction: rtl;
}

/* ---------- Tables ---------- */
.table-responsive,
.section table {
    max-width: 100%;
}

.table {
    --bs-table-striped-bg: transparent;
    --bs-table-hover-bg: var(--surface-2);
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1rem;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.table > :not(caption) > * > * {
    padding: .65rem .8rem;
    border: 0;
    border-bottom: 1px solid var(--border);
    box-shadow: none;
    background: transparent;
}

.table > tbody > tr:last-child > * {
    border-bottom: 0;
}

.table > thead > tr > th {
    background: var(--surface-2);
    color: var(--muted);
    font-size: .82rem;
    font-weight: 600;
    white-space: nowrap;
}

.table > :not(:last-child) > :last-child > * {
    border-bottom-color: var(--border);
}

.table > tbody > tr:hover > * {
    background: var(--surface-2);
}

.table tbody th {
    font-weight: 600;
}

.table tbody th a {
    color: var(--gold-text);
}

.table small {
    color: var(--muted);
}

.table-bordered > :not(caption) > * > * {
    border-width: 0 0 1px;
}

.table-rate {
    display: inline-block;
    min-width: 4.5rem;
    padding: .1rem .5rem;
    background: transparent;
    border-radius: 999px;
    font-weight: 600;
    text-align: center;
}

.table-rate.rising,
.table-rate.falling,
.table-rate.stable {
    font-size: .88rem;
}

td:has(> .table-rate) {
    text-align: center;
}

.change-green {
    animation: flash-up .8s ease;
}

.change-red {
    animation: flash-down .8s ease;
}

@keyframes flash-up {
    from { background: var(--up-bg); }
    to { background: transparent; }
}

@keyframes flash-down {
    from { background: var(--down-bg); }
    to { background: transparent; }
}

/* ---------- Notes, FAQ, breadcrumbs ---------- */
.note {
    font-size: .88rem;
    line-height: 1.85;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-inline-start: 3px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: .75rem 1rem;
    margin: 1rem 0;
}

.faq details {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0;
    margin-bottom: .6rem;
}

.faq summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: .8rem 1rem;
    font-weight: 600;
    cursor: pointer;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary::after {
    content: "+";
    flex: 0 0 auto;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--muted);
}

.faq details[open] summary::after {
    content: "−";
}

.faq details > div {
    margin: 0;
    padding: 0 1rem .9rem;
    color: var(--muted);
    line-height: 1.9;
}

nav[aria-label="breadcrumb"] {
    margin-bottom: .5rem;
}

.breadcrumb {
    padding: 0;
    font-size: .85rem;
}

.breadcrumb li,
.breadcrumb li.active span {
    color: var(--muted);
}

.breadcrumb li.active span {
    font-weight: 500;
}

.breadcrumb li a {
    color: var(--gold-text);
}

.breadcrumb li a:hover {
    color: var(--text);
}

/* ---------- Sidebar widgets ---------- */
.sidebar .widget {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    overflow: hidden;
}

.sidebar .widget-header {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .85rem 1rem;
    font-size: 1rem;
    font-weight: 700;
}

.sidebar .widget-content .table {
    border: 0;
    border-radius: 0;
    margin: 0;
}

.sidebar .widget-content .table > :not(caption) > * > * {
    padding: .55rem 1rem;
}

/* ---------- Forms ---------- */
.form-control,
.calculator-form-control {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(201, 151, 28, .2);
    outline: 0;
}

.btn-primary,
.btn-success {
    background: var(--text);
    border-color: var(--text);
    color: #fff;
    border-radius: var(--radius-sm);
}

.egp-calc input {
    max-width: 110px;
}

.egp-calculator {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.25rem 1.4rem;
    margin-bottom: 1rem;
}

.calc-field label {
    display: block;
    font-size: .88rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .35rem;
}

.calc-field .form-control,
.calc-field select {
    width: 100%;
    height: 44px;
    padding: 0 .8rem;
    background: var(--surface);
}

.calc-field:has(input[type="checkbox"]) {
    grid-column: 1 / -1;
}

.calc-field:has(input[type="checkbox"]) label {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    font-weight: 500;
    margin: 0;
}

.col-md-8 > .calc-results {
    background: var(--surface);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
}

.calc-results td {
    font-weight: 600;
    white-space: nowrap;
}

.calc-results .total > * {
    background: var(--gold-soft) !important;
    font-size: 1.05rem;
}

/* ---------- Footer ---------- */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: start;
    font-size: .92rem;
    padding: 0;
    margin-top: 1rem;
}

.footer-inner {
    max-width: 1170px;
    margin: 0 auto;
    padding: 2rem 15px 1.5rem;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
}

.footer-brand p {
    color: var(--muted);
    margin-top: .75rem;
    max-width: 30rem;
    line-height: 1.9;
}

.footer-logo img {
    height: 40px;
    width: auto;
}

.footer h3 {
    font-size: .95rem;
    margin-bottom: .6rem;
}

.footer ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer li,
#footer-menu li {
    display: block;
    padding: .2rem 0;
}

.footer li a {
    color: var(--muted);
}

.footer li a:hover,
.footer li a.active {
    color: var(--gold-text);
}

.footer-bottom {
    max-width: 1170px;
    margin: 0 auto;
    padding: 1rem 15px 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: .5rem;
    color: var(--muted);
    font-size: .82rem;
}

#copyright {
    padding: 0;
}

/* ---------- Small screens ---------- */
@media (max-width: 767.98px) {
    h1 {
        font-size: 1.45rem;
    }

    h2,
    .h2 {
        font-size: 1.12rem;
    }

    .container {
        margin-top: 1rem;
        padding: 0 12px;
    }

    .col-md-8 > .section,
    .col-md-8 > section,
    .col-md-12 > .section,
    .col-md-12 > section {
        padding: 1rem;
        border-radius: 12px;
    }

    .hero-main {
        padding: 1.1rem 1rem 1rem;
    }

    .hero .price-cards {
        padding: .85rem;
        grid-template-columns: repeat(2, 1fr);
        gap: .6rem;
    }

    .price-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .table > :not(caption) > * > * {
        padding: .55rem .5rem;
        font-size: .9rem;
    }

    .table-rate {
        min-width: 0;
    }

    .table > thead > tr > th {
        white-space: normal;
    }

    .historical > :not(caption) > * > * {
        padding: .5rem .35rem;
        font-size: .82rem;
    }

    .ticker {
        padding: .4rem .5rem .75rem;
    }

    .header-bar-item {
        flex-basis: 158px;
    }

    .footer-inner {
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .hero .price-card:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition: none !important;
    }
}
