/* =====================================================
   RESET
===================================================== */

* {
    box-sizing: border-box;
}

html {
    direction: rtl;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    padding: 0;
    font-family: "Vazirmatn", Tahoma, Arial, sans-serif;
    background: #fffdf8;
    color: #173b3a;
    line-height: 1.8;
}

a {
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

:root {
    --teal: #0f766e;
    --teal-dark: #123f3d;
    --teal-light: #e8f5f2;
    --gold: #e4a923;
    --gold-light: #fff7df;
    --cream: #fffdf8;
    --text: #173b3a;
    --muted: #70807f;
    --border: #e5eeee;
    /*
     * PHASE G breakpoints (chosen from layout, not stacked emergencies):
     * 1024px+  desktop header (links + CTA + account)
     * ≤1023px  compact header (logo + account + drawer)
     * ≤768px   bottom tab bar on public pages
     * Reason: 701–800px previously kept the desktop nav (switch was 700px)
     * and overflowed. Compact mode starts at 1023px so that range is stable.
     */
    --dd-header-break: 1023px;
    --dd-tabbar-break: 768px;
}

.dd-skip-link {
    position: absolute;
    right: 12px;
    top: -80px;
    z-index: 2000;
    background: var(--teal);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-weight: 700;
}

.dd-skip-link:focus {
    top: 12px;
}

body.dd-nav-lock {
    overflow: hidden;
}

/* =====================================================
   HEADER
===================================================== */

.dd-site-header {
    position: relative;
    z-index: 1000;
    background: rgba(255, 255, 255, .97);
    border-bottom: 1px solid var(--border);
}

.dd-header-bar {
    width: min(1200px, calc(100% - 40px));
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    z-index: 60;
}

.dd-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--teal);
    flex: 0 0 auto;
}

.dd-logo-text {
    display: flex;
    flex-direction: column;
}

.dd-logo-text strong {
    font-size: 20px;
    line-height: 1.2;
}

.dd-logo-text small {
    font-size: 11px;
    color: var(--muted);
}

.dd-desktop-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    gap: 8px 22px;
    flex-wrap: nowrap;
}

.dd-desktop-nav a,
.dd-header-login,
.dd-header-register,
.dd-drawer-nav a {
    color: #405958;
    font-size: 14px;
    font-weight: 600;
}

.dd-desktop-nav a:hover,
.dd-header-login:hover,
.dd-header-register:hover,
.dd-drawer-nav a:hover {
    color: var(--teal);
}

.dd-desktop-nav a.is-current,
.dd-header-login.is-current,
.dd-header-register.is-current,
.dd-drawer-nav a.is-current {
    color: var(--teal);
    font-weight: 800;
}

.dd-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-inline-start: auto;
    flex: 0 0 auto;
}

.dd-header-auth {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dd-header-account-icon,
.dd-nav-toggle,
.dd-nav-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    border-radius: 12px;
    padding: 0;
}

.dd-header-account-icon svg,
.dd-nav-toggle svg,
.dd-nav-close svg,
.dd-tabbar-icon svg {
    width: 22px;
    height: 22px;
    display: block;
}

.dd-account-menu {
    position: relative;
}

.dd-account-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 999px;
    padding: 4px 12px 4px 4px;
    cursor: pointer;
    color: var(--text);
    max-width: 180px;
}

.dd-account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--teal-light);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    position: relative;
}

.dd-unread-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-inline-start: 6px;
    border-radius: 999px;
    background: #e85d4a;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
}

.dd-account-avatar .dd-unread-badge,
.dd-tabbar-icon .dd-unread-badge {
    position: absolute;
    top: -6px;
    inset-inline-end: -8px;
    margin: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
    box-shadow: 0 0 0 2px #fff;
}

.dd-tabbar-icon {
    position: relative;
    overflow: visible;
}

.dd-account-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 700;
}

.dd-account-dropdown {
    position: absolute;
    inset-inline-end: 0;
    top: calc(100% + 8px);
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(18, 63, 61, .12);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 20;
}

.dd-account-dropdown[hidden] {
    display: none;
}

.dd-account-dropdown-name {
    margin: 0 8px 8px;
    font-size: 13px;
    font-weight: 800;
    color: var(--text);
}

.dd-account-dropdown a,
.dd-drawer-nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
}

.dd-account-dropdown a:hover,
.dd-drawer-nav a:hover {
    background: var(--teal-light);
}

.dd-account-logout {
    color: #8b2e2e !important;
}

.dd-nav-overlay,
.dd-nav-drawer {
    display: none;
}

.dd-site-header a:focus-visible,
.dd-site-header button:focus-visible,
.dd-tabbar a:focus-visible,
.dd-site-footer a:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 3px;
}

/* =====================================================
   FOOTER
===================================================== */

.dd-site-footer {
    background: linear-gradient(180deg, #0f4f4c 0%, #123f3d 100%);
    color: #fff;
    padding: 0 6% 0;
    margin-top: 0;
}

.dd-footer-inner {
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
    gap: 36px;
    padding: 48px 0 36px;
}

.dd-footer-logo {
    margin: 0 0 6px;
    font-size: 24px;
    font-weight: 900;
    letter-spacing: -.02em;
}

.dd-footer-tagline {
    margin: 0 0 14px;
    color: #7ecfc7;
    font-size: 13px;
    font-weight: 700;
}

.dd-footer-desc {
    margin: 0;
    color: #b9cecc;
    font-size: 14px;
    line-height: 2;
    max-width: 28rem;
}

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

.dd-footer-col h2 {
    margin: 0 0 14px;
    font-size: 15px;
    font-weight: 800;
    position: relative;
    padding-bottom: 10px;
}

.dd-footer-col h2::after {
    content: "";
    position: absolute;
    inset-inline-start: 0;
    bottom: 0;
    width: 28px;
    height: 3px;
    border-radius: 999px;
    background: #7ecfc7;
}

.dd-footer-col a,
.dd-footer-col p {
    margin: 0;
    color: #b9cecc;
    font-size: 14px;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
}

.dd-footer-col a:hover,
.dd-footer-col a.is-current {
    color: #fff;
}

.dd-footer-social {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.dd-footer-social a {
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 13px;
}

.dd-footer-bottom {
    max-width: 1120px;
    margin: 0 auto;
    padding: 18px 0 24px;
    border-top: 1px solid rgba(255, 255, 255, .1);
    color: #8fa9a6;
    font-size: 12px;
    text-align: center;
    line-height: 1.8;
}

/* =====================================================
   TAB BAR (public mobile only)
===================================================== */

.dd-tabbar {
    display: none;
}

/* Compact header: ≤1023px — physical LTR slots so RTL does not flip them */
@media (max-width: 1023px) {
    .dd-header-bar {
        width: min(100% - 24px, 1200px);
        min-height: 64px;
        direction: ltr;
        display: grid;
        grid-template-columns: 48px minmax(0, 1fr) 48px;
        align-items: center;
        gap: 8px;
    }

    .dd-desktop-nav,
    .dd-header-auth,
    .dd-account-name {
        display: none;
    }

    .dd-logo {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        direction: rtl;
        text-align: center;
    }

    .dd-logo-text small {
        display: none;
    }

    .dd-header-actions {
        display: contents;
        margin: 0;
    }

    .dd-header-account-icon,
    .dd-account-menu {
        grid-column: 1;
        grid-row: 1;
        justify-self: center;
        direction: rtl;
    }

    .dd-nav-toggle {
        grid-column: 3;
        grid-row: 1;
        justify-self: center;
        display: inline-flex;
    }

    .dd-nav-close {
        display: inline-flex;
    }

    .dd-header-account-icon {
        display: inline-flex;
    }

    .dd-account-toggle {
        padding: 4px;
        max-width: none;
        border-color: transparent;
        background: var(--teal-light);
    }

    .dd-nav-overlay,
    .dd-nav-overlay[hidden] {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(18, 63, 61, .35);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .28s ease, visibility 0s linear .28s;
    }

    .dd-nav-drawer,
    .dd-nav-drawer[hidden] {
        display: block;
        position: fixed;
        top: 64px;
        right: 0;
        bottom: 0;
        left: auto;
        width: min(320px, 88vw);
        background: #fff;
        z-index: 60;
        padding: 16px 16px 32px;
        box-shadow: -12px 0 32px rgba(18, 63, 61, .14);
        overflow-y: auto;
        direction: rtl;
        transform: translateX(110%);
        visibility: hidden;
        pointer-events: none;
        transition: transform .28s ease, visibility 0s linear .28s;
    }

    .dd-site-header.is-nav-open .dd-nav-overlay {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: opacity .28s ease;
    }

    .dd-site-header.is-nav-open .dd-nav-drawer {
        transform: translateX(0);
        visibility: visible;
        pointer-events: auto;
        transition: transform .28s ease;
    }

    .dd-nav-drawer-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 12px;
    }

    .dd-nav-close {
        display: inline-flex;
    }

    .dd-account-dropdown {
        left: 0;
        right: auto;
        transform-origin: top left;
    }
}

@media (min-width: 1024px) {
    .dd-nav-overlay,
    .dd-nav-drawer,
    .dd-nav-toggle,
    .dd-header-account-icon {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .dd-tabbar {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        right: 0;
        left: 0;
        bottom: 0;
        z-index: 50;
        height: 72px;
        background: rgba(255, 255, 255, .97);
        border-top: 1px solid var(--border);
        box-shadow: 0 -6px 24px rgba(0, 0, 0, .06);
    }

    .dd-tabbar a {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        color: #687b79;
        font-size: 11px;
        font-weight: 600;
    }

    .dd-tabbar a.is-current {
        color: var(--teal);
        font-weight: 800;
    }

    .dd-tabbar-cta {
        position: relative;
        top: -12px;
        color: var(--teal);
        font-weight: 800;
    }

    .dd-tabbar-cta .dd-tabbar-icon {
        width: 48px;
        height: 48px;
        border-radius: 50%;
        background: var(--teal);
        color: #fff;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 4px solid #fff;
        box-shadow: 0 6px 16px rgba(15, 118, 110, .25);
    }

    .dd-tabbar-cta .dd-tabbar-icon svg {
        width: 22px;
        height: 22px;
    }

    .dd-footer-inner {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .dd-footer-col a,
    .dd-footer-col p {
        min-height: 44px;
    }

    .dd-site-footer {
        padding-inline: 20px;
    }

    .dd-footer-inner {
        padding: 36px 0 28px;
    }

    .dd-footer-bottom {
        padding-bottom: 28px;
    }

    body.dd-has-tabbar .dd-site-footer {
        padding-bottom: 108px;
    }

    .dd-nav-drawer {
        padding-bottom: 96px;
    }
}

@media (max-width: 360px) {
    .dd-tabbar a {
        font-size: 10px;
    }

    .dd-logo-text strong {
        font-size: 18px;
    }
}
