* {
    box-sizing: border-box;
}

body {
    font-family: "Vazirmatn", Tahoma, sans-serif;
    background: #faf8f5;
    color: #222;
    margin: 0;
    padding: 0;
}

main {
    max-width: 900px;
    margin: 0 auto 24px;
    padding: 0 16px;
}

/* Wider premium layout used by the redesigned home page only — other
   pages keep the narrow 900px main above until they're redesigned too. */
main.home-main {
    max-width: 1500px;
    padding: 0 16px;
}

@media (min-width: 768px) {
    main.home-main {
        padding: 0 32px;
    }
}

/* ---------------- Top navigation ---------------- */

.site-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 14px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.nav-links {
    display: flex;
    gap: 20px;
    align-items: center;
}

.nav-links-right {
    justify-content: flex-start;
}

.nav-links-left {
    justify-content: flex-end;
}

.nav-link {
    font-size: 13.5px;
    color: #555;
    text-decoration: none;
    cursor: pointer;
    padding-bottom: 3px;
    border-bottom: 2px solid transparent;
}

    .nav-link.active {
        color: #222;
        font-weight: 600;
        border-bottom-color: #FFA500;
    }

    .nav-link.disabled {
        color: #555;
        cursor: default;
    }

.nav-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.nav-logo-icon {
    font-size: 20px;
}

.nav-logo-text {
    font-size: 17px;
    font-weight: 800;
    color: #222;
    letter-spacing: 0.3px;
}

.nav-logo-accent {
    color: #FFA500;
}

/* ---------------- Section title ---------------- */

.section-title-wrap {
    padding: 30px 24px 22px;
    text-align: center;
    background: linear-gradient(180deg, #FFF6EA 0%, #faf8f5 100%);
    margin: 0 -16px 24px;
}

.section-title {
    font-size: 21px;
    font-weight: 700;
    color: #222;
}

    .section-title .accent {
        color: #E8940A;
    }

    .section-title .sep {
        color: #ddd;
        font-weight: 400;
    }

.section-sub {
    font-size: 13px;
    color: #999;
    margin-top: 8px;
}

/* ---------------- Market tabs ---------------- */

.market-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.tab-btn,
.gold-tab-btn {
    flex: 1;
    text-align: center;
    padding: 12px;
    border-radius: 12px;
    background: white;
    border: 1px solid #eee;
    color: #999;
    font-weight: 500;
    font-size: 14.5px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
}

    .tab-btn.active,
    .gold-tab-btn.active {
        background: #2A2523;
        border-color: #2A2523;
        color: white;
        font-weight: 600;
    }

/* ---------------- Rate panels & rows ---------------- */

.rate-panel {
    display: none;
}

    .rate-panel.active {
        display: block;
    }

.rate-list {
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    overflow: hidden;
}

.rate-row {
    display: grid;
    grid-template-columns: 32px 1fr 100px 1px 100px 90px;
    align-items: center;
    gap: 10px;
    padding: 14px 22px;
    border-bottom: 1px solid #f4f2ee;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.12s ease;
}

    .rate-row:hover {
        background: #faf8f5;
    }

    .rate-row:last-child {
        border-bottom: none;
    }

.rate-flag {
    font-size: 22px;
}

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

.rate-fa {
    font-weight: 700;
    font-size: 14.5px;
    color: #222;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rate-code {
    font-size: 10.5px;
    color: #aaa;
    font-family: monospace;
}

.rate-numbers {
    display: contents;
}

.rate-num-block {
    text-align: left;
}

.rate-num-label {
    font-size: 10px;
    color: #bbb;
    margin-bottom: 2px;
}

.rate-num-value {
    font-size: 16px;
    font-weight: 700;
    color: #222;
    font-family: monospace;
    font-variant-numeric: tabular-nums;
}

.rate-divider {
    width: 1px;
    height: 26px;
    background: #eee;
    justify-self: center;
}

.rate-trend {
    display: flex;
    align-items: center;
    gap: 3px;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    font-family: monospace;
    justify-content: center;
    justify-self: end;
}

    .rate-trend .tri {
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
    }

    .rate-trend.up {
        background: #eef8f0;
        color: #1e9e4a;
    }

        .rate-trend.up .tri {
            border-bottom: 6px solid #1e9e4a;
        }

    .rate-trend.down {
        background: #fdf1ef;
        color: #d64545;
    }

        .rate-trend.down .tri {
            border-top: 6px solid #d64545;
        }

    .rate-trend.flat {
        background: #f5f5f4;
        color: #aaa;
    }

.rate-row.no-data {
    opacity: 0.55;
}

.rate-no-data-msg {
    font-size: 12px;
    color: #bbb;
    font-style: italic;
    grid-column: 3 / -1;
    text-align: left;
}

/* ---------------- Convert page ---------------- */

.page-title-wrap {
    max-width: 900px;
    margin: 24px auto 0;
    text-align: center;
    padding: 0 16px;
}

.page-title {
    font-size: 19px;
    font-weight: 700;
    color: #222;
}

    .page-title .accent {
        color: #E8940A;
    }

.page-sub {
    font-size: 12px;
    color: #999;
    margin-top: 6px;
}

.convert-wrap {
    max-width: 900px;
    margin: 20px auto 0;
    padding: 0 16px 24px;
}

.convert-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.convert-input-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 6px;
}

.input-box, .select-box {
    border: 1px solid #eee;
    background: #faf8f5;
    border-radius: 12px;
    padding: 14px 16px;
    font-family: "Vazirmatn", monospace;
    font-size: 16px;
    font-weight: 700;
    color: #222;
    width: 100%;
}

.select-box {
    cursor: pointer;
}

.convert-btn {
    width: 100%;
    margin-top: 16px;
    background: #FFA500;
    color: white;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
}

    .convert-btn:hover {
        background: #E8940A;
    }

.convert-error {
    margin-top: 16px;
    background: #fdf1ef;
    color: #d64545;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 13.5px;
    text-align: center;
}

.result-card {
    background: white;
    border: 1px solid #eee;
    border-radius: 16px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* ---------------- Footer ---------------- */

.site-footer {
    text-align: center;
    color: #bbb;
    font-size: 12px;
    padding: 24px 16px;
}

/* ---------------- Currency detail page ---------------- */

.fluctuation-panel {
    display: none;
}

    .fluctuation-panel.active {
        display: block;
    }

.timeframe-panel {
    display: none;
}

    .timeframe-panel.active {
        display: block;
    }

/* ---------------- Reusable segmented control ----------------
   Generic version of the pill-style segmented control introduced on
   the home page (there it's scoped under .home-main). Any page can use
   it directly — pair a .segment-control wrapper with .segment-btn
   children (plus a page-specific functional class for its own JS
   hook, e.g. .market-toggle-btn or .timeframe-tab) and add "active" to
   the selected one. */
.segment-control {
    background: #F1F5F9;
    padding: 6px;
    border-radius: 20px;
    display: flex;
    gap: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    overflow-x: auto;
}

.segment-btn {
    flex: 1;
    padding: 10px 18px;
    border-radius: 14px;
    font-size: 13.5px;
    font-weight: 600;
    color: #64748B;
    background: transparent;
    border: none;
    font-family: inherit;
    white-space: nowrap;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    cursor: pointer;
}

    .segment-btn.active {
        color: #1A1D20;
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
        font-weight: 700;
    }

@media (max-width: 640px) {
    .segment-btn {
        padding: 7px 12px;
        font-size: 12.5px;
    }
}

/* ---------------- Responsive ---------------- */

@media (max-width: 480px) {
    .rate-row {
        flex-wrap: wrap;
    }

    .rate-numbers {
        gap: 14px;
    }

    .rate-num-value {
        font-size: 17px;
    }
}

/* ---------------- Search (nav trigger + overlay) ---------------- */

.search-trigger {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #FFA500;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 100;
    padding: 80px 16px 0;
}

    .search-overlay.active {
        display: block;
    }

.search-box-wrap {
    max-width: 500px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 14px;
    padding: 12px 18px;
    gap: 10px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.15);
}

.search-input {
    flex: 1;
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
}

.search-close {
    color: #ccc;
    cursor: pointer;
    font-size: 14px;
}

.search-results {
    background: white;
    border-radius: 14px;
    margin-top: 6px;
    overflow: hidden;
    box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}

.search-result-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f4f2ee;
    text-decoration: none;
    color: inherit;
}

    .search-result-row:last-child {
        border-bottom: none;
    }

    .search-result-row:hover {
        background: #FFF6EA;
    }

.search-result-flag {
    font-size: 20px;
}

.search-result-name {
    font-size: 13.5px;
    font-weight: 700;
}

.search-result-code {
    font-size: 10.5px;
    color: #999;
}

/* ---------------- Ad columns ----------------
   Grid-based (not absolutely positioned) so the ad rail works for both
   the narrow legacy pages (main max-width: 900px) and the wide home
   page (main.home-main max-width: 1500px) — `main` centers itself
   inside the middle grid track either way.

   Breakpoints: hidden below 1024px (no room / avoids a cramped rail on
   tablet), a single right-hand column from 1024–1279px (fills what
   would otherwise be dead side margin), both columns from 1280px up. */

.content-with-ads {
    display: block;
}

.ad-column {
    display: none;
    flex-direction: column;
    gap: 14px;
    width: 140px;
}

@media (min-width: 1024px) {
    .content-with-ads {
        display: grid;
        grid-template-columns: 140px 1fr;
        column-gap: 24px;
        align-items: start;
        /* Breathing room between the ad rail and the viewport edge —
           without this the ad columns sit flush against the browser
           window on wide screens. */
        padding: 0 40px;
    }

    .ad-column-right {
        display: flex;
        grid-column: 1;
        grid-row: 1;
    }

    main {
        grid-column: 2;
        grid-row: 1;
    }
}

@media (min-width: 1280px) {
    .content-with-ads {
        grid-template-columns: 140px 1fr 140px;
    }

    .ad-column-left {
        display: flex;
        grid-column: 3;
    }

    .ad-column-right {
        grid-column: 1;
    }

    main {
        grid-column: 2;
    }
}

.ad-slot {
    background: white;
    border: 2px dashed #FFA500;
    border-radius: 16px;
    height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.ad-slot-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #FFA500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-slot-label {
    font-size: 12px;
    color: #c77b00;
    font-weight: 700;
}

.ad-slot-size {
    font-size: 10px;
    color: #d99a3f;
}

/* Softer "premium mockup" ad placeholder style used in the new header/
   footer chrome (_Layout.cshtml), separate from the legacy .ad-slot
   above so unconverted pages keep their existing dashed-orange look
   until they're redesigned too. */
.ad-slot-modern {
    border: 1.5px dashed #d1d5db;
    border-radius: 24px;
    height: 100%;
    min-height: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.4);
    color: #94A3B8;
    position: sticky;
    top: 140px;
}

.ad-slot-modern-label {
    font-size: 13px;
    font-weight: 700;
}

.ad-slot-modern-size {
    font-size: 11px;
    opacity: 0.7;
    font-family: monospace;
}

/* ---------------- Collapsed currency list ---------------- */

.rate-list-collapsed {
    display: none;
}

    .rate-list-collapsed.expanded {
        display: block;
    }

.show-all-wrap {
    position: relative;
}

.show-all-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: calc(100% - 32px);
    margin: 12px 16px 16px;
    background: #FFA500;
    color: white;
    border: none;
    border-radius: 24px;
    padding: 10px 24px;
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

    .show-all-btn.expanded {
        background: #f0ede8;
        color: #999;
    }

/* ---------------- Rich footer ---------------- */

.site-footer-rich {
    max-width: 900px;
    margin: 40px auto 0;
    background: #2A2523;
    border-radius: 24px 24px 0 0;
}

.footer-telegram-cta {
    background: linear-gradient(135deg, #FFA500 0%, #E8940A 100%);
    border-radius: 24px 24px 0 0;
    padding: 22px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.footer-telegram-title {
    font-size: 15px;
    font-weight: 700;
    color: white;
}

.footer-telegram-sub {
    font-size: 12px;
    color: rgba(255,255,255,0.85);
    margin-top: 2px;
}

.footer-telegram-btns {
    display: flex;
    gap: 10px;
}

.footer-btn-solid {
    background: white;
    color: #E8940A;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: none;
}

.footer-btn-outline {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 9px 18px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 700;
    border: 1px solid rgba(255,255,255,0.4);
    text-decoration: none;
}

.footer-columns {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 28px;
    padding: 32px 32px 24px;
}

.footer-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.footer-brand-icon {
    font-size: 20px;
}

.footer-brand-text {
    font-size: 17px;
    font-weight: 800;
    color: white;
}

.footer-brand-accent {
    color: #FFA500;
}

.footer-brand-desc {
    font-size: 12.5px;
    color: #999;
    line-height: 1.8;
}

.footer-col-title {
    font-size: 13px;
    font-weight: 700;
    color: white;
    margin-bottom: 4px;
}

.footer-link {
    font-size: 12.5px;
    color: #999;
    text-decoration: none;
}

    .footer-link.disabled {
        color: #666;
    }

.footer-social-row {
    display: flex;
    gap: 10px;
}

.footer-social-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #3a332f;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .footer-social-icon.disabled {
        opacity: 0.4;
    }

.footer-bottom {
    border-top: 1px solid #3a332f;
    padding: 18px 32px;
    text-align: center;
}

    .footer-bottom p {
        font-size: 11.5px;
        color: #777;
        margin: 0;
    }

.contact-success {
    background: #eef8f0;
    color: #1e9e4a;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
}

@media (max-width: 900px) {
    .footer-columns {
        grid-template-columns: 1fr 1fr;
    }
}


/* ---------------- Crypto rows ---------------- */

.crypto-row {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f4f2ee;
    gap: 10px;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background 0.12s ease;
}

    .crypto-row:hover {
        background: #faf8f5;
    }

    .crypto-row:last-child {
        border-bottom: none;
    }

.crypto-rank {
    font-size: 11px;
    color: #ccc;
    width: 20px;
    flex-shrink: 0;
}

.crypto-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.crypto-icon-fallback {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #ddd;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.crypto-name {
    flex: 1;
    min-width: 0;
}

.crypto-name-fa {
    font-weight: 700;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crypto-symbol {
    font-size: 10.5px;
    color: #aaa;
}

.crypto-sparkline {
    flex-shrink: 0;
}

.crypto-price-block {
    flex-shrink: 0;
    min-width: 80px;
    text-align: left;
}

.crypto-price {
    font-size: 14px;
    font-weight: 700;
    font-family: monospace;
}

.crypto-price-afn {
    font-size: 10px;
    color: #999;
    font-family: monospace;
    margin-top: 1px;
}

/* ---------------- Home page sub-sections (gold / crypto preview) ---------------- */

.section-below-title {
    max-width: 900px;
    margin: 28px auto 14px;
    padding: 0 16px;
    text-align: center;
}

.section-below-icon {
    font-size: 17px;
    font-weight: 700;
    color: #bbb;
}

    .section-below-icon.accent-icon {
        color: #222;
    }

    .section-below-icon .accent {
        color: #E8940A;
    }

/* ---------------- Gold section (3-tab: Kabul/Herat/Global) ---------------- */

.gold-panel {
    display: none;
}

    .gold-panel.active {
        display: block;
    }

.gold-carat-row {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 14px 20px;
    border-bottom: 1px solid #f4f2ee;
}

    .gold-carat-row:last-child {
        border-bottom: none;
    }

.gold-carat-label {
    font-weight: 700;
    font-size: 14px;
    color: #222;
    justify-self: start;
}

.gold-accent-word {
    color: #FFA500;
}

.gold-carat-unit {
    font-size: 12px;
    color: #999;
    padding: 0 16px;
    white-space: nowrap;
}

.gold-carat-right {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-self: end;
}

.gold-carat-value {
    font-size: 15px;
    font-weight: 700;
    font-family: monospace;
    color: #222;
    white-space: nowrap;
}

/* ---------------- Language switcher ---------------- */

.lang-switcher {
    display: flex;
    gap: 4px;
    background: #f5f5f4;
    border-radius: 8px;
    padding: 3px;
}

.lang-link {
    font-size: 11.5px;
    padding: 4px 8px;
    border-radius: 6px;
    color: #999;
    text-decoration: none;
}

    .lang-link.active {
        background: #FFA500;
        color: white;
        font-weight: 600;
    }
