/* Mobile side drawer menu */
/* ---- Mobile drawer: change these colors to match your theme ---- */
:root {
    --md-bg-top: #2c4254;     /* drawer background (top)    */
    --md-bg-bottom: #17222c;  /* drawer background (bottom) */
    --md-accent: #1fb6d1;     /* highlight color            */
    --md-text: #e9eef2;
    --md-muted: #9fb0bf;
    --md-line: rgba(255,255,255,.08);
}
.md-overlay {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; background: rgba(0,0,0,.5); z-index: 1080;
    opacity: 0; visibility: hidden; transition: opacity .3s, visibility .3s;
}
.md-drawer {
    position: fixed; top: 0; right: 0; bottom: 0; width: 82%; max-width: 330px; z-index: 1090;
    background: linear-gradient(180deg, var(--md-bg-top), var(--md-bg-bottom));
    color: var(--md-text); direction: rtl; text-align: right;
    display: flex; flex-direction: column;
    transform: translateX(105%); transition: transform .3s cubic-bezier(.4,0,.2,1);
    box-shadow: -8px 0 30px rgba(0,0,0,.35);
    border-radius: 18px 0 0 18px;
}
body.md-open .md-overlay { opacity: 1; visibility: visible; }
body.md-open .md-drawer { transform: translateX(0); }
body.md-open { overflow: hidden; }

.md-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--md-line); }
.md-logo { height: 34px; width: auto; }
.md-close { background: rgba(255,255,255,.08); border: 0; color: var(--md-text); width: 36px; height: 36px; border-radius: 50%; font-size: 16px; }
.md-close:focus { outline: none; }

.md-body { flex: 1; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }

.md-user { display: flex; align-items: center; margin-bottom: 14px; }
.md-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--md-accent); margin-left: 12px; }
.md-user-info { min-width: 0; }
.md-user-name { font-weight: 700; font-size: 15px; }
.md-user-email { font-size: 12px; color: var(--md-muted); text-align: right; word-break: break-all; }

.md-quick { display: flex; margin: 0 -3px 16px; }
.md-quick a { flex: 1; margin: 0 3px; text-align: center; padding: 10px 4px; border-radius: 12px; background: rgba(255,255,255,.06); color: var(--md-text) !important; font-size: 12px; text-decoration: none !important; }
.md-quick a i { display: block; font-size: 17px; color: var(--md-accent); margin-bottom: 5px; }
.md-quick a:active { background: rgba(255,255,255,.12); }

.md-auth { display: flex; margin: 0 -3px 16px; }
.md-btn { flex: 1; text-align: center; padding: 10px; border-radius: 10px; font-weight: 700; text-decoration: none !important; margin: 0 3px; }
.md-btn-fill { background: var(--md-accent); color: #fff !important; }
.md-btn-line { border: 1px solid var(--md-accent); color: var(--md-accent) !important; }

.md-search { display: flex; background: rgba(255,255,255,.08); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.md-search input { flex: 1; background: transparent; border: 0; color: var(--md-text); padding: 10px 12px; font-size: 14px; min-width: 0; }
.md-search input::placeholder { color: var(--md-muted); }
.md-search input:focus { outline: none; }
.md-search button {
    background: var(--md-accent); border: 0; color: #fff; width: 46px; min-height: 42px;
    padding: 0; margin: 0; border-radius: 0; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.md-search button i { margin: 0; line-height: 1; font-size: 16px; }

.md-title { font-size: 12px; color: var(--md-muted); margin: 0 4px 8px; }

.md-menu .md-link {
    display: flex; align-items: center; justify-content: space-between;
    padding: 12px; border-radius: 10px; color: var(--md-text) !important; font-size: 15px;
    text-decoration: none !important; cursor: pointer; list-style: none;
}
.md-menu .md-link:hover, .md-menu .md-link:active { background: rgba(255,255,255,.06); }
.md-menu summary::-webkit-details-marker { display: none; }
.md-menu summary { outline: none; }
.md-chevron { font-size: 11px; color: var(--md-muted); transition: transform .25s; }
.md-group[open] > summary { color: var(--md-accent) !important; }
.md-group[open] > summary .md-chevron { transform: rotate(180deg); color: var(--md-accent); }
.md-sub { margin: 2px 14px 6px 0; padding-right: 10px; border-right: 2px solid var(--md-line); }
.md-sub .md-link { font-size: 14px; padding: 9px 10px; color: var(--md-muted) !important; }
.md-sub .md-all { color: var(--md-accent) !important; }

.md-foot { padding: 12px 16px 18px; border-top: 1px solid var(--md-line); }
.md-logout { display: block; text-align: center; padding: 11px; border-radius: 10px; background: rgba(231,76,60,.12); color: #ff7b6b !important; text-decoration: none !important; font-weight: 700; }

/* ================= Mobile / tablet top bar ================= */
@media (max-width: 991.98px) {
    /* top bar = [right buttons] [logo, centered in the space left] [left buttons] */
    .navbar > .container-fluid { flex-wrap: nowrap; align-items: center; }
    .mobileRightIcons, .mobileLeftIcons { flex: 0 0 auto; }
    .navbar .md-center-logo {
        flex: 1 1 auto; min-width: 0; display: flex; align-items: center; justify-content: center;
        margin: 0 !important; padding: 0 8px !important;
    }
    /* menu button: no gray box on hover / tap */
    .navbar .navbar-toggler,
    .navbar .navbar-toggler:hover,
    .navbar .navbar-toggler:focus,
    .navbar .navbar-toggler:active {
        background: transparent !important; box-shadow: none !important; outline: none !important;
    }
}

/* ---- notifications popup ---- */
.mnotif { position: relative; }
.mnotif > a { position: relative; }
.mnotif-badge {
    position: absolute; top: 0; right: 0; min-width: 17px; height: 17px; line-height: 17px;
    padding: 0 4px; border-radius: 9px; background: #e74c3c; color: #fff; font-size: 10px; text-align: center;
}
.mnotif .mnotif-box {
    position: absolute; top: calc(100% + 12px); left: 0; right: auto;
    width: 300px; max-width: calc(100vw - 20px); padding: 0; margin: 0;
    border: 0; border-radius: 14px; overflow: visible; direction: rtl; text-align: right;
    box-shadow: 0 12px 35px rgba(0,0,0,.25);
}
.mnotif .mnotif-box::before {          /* little arrow pointing at the bell */
    content: ""; position: absolute; top: -7px; left: 14px;
    width: 14px; height: 14px; background: #fff; transform: rotate(45deg);
    border-radius: 3px 0 0 0;
}
.mnotif-head { position: relative; padding: 12px 16px; font-weight: 700; border-bottom: 1px solid #eee; color: #2c4254; }
.mnotif-list { max-height: 320px; overflow-y: auto; }
.mnotif-item { display: block; padding: 10px 16px; border-bottom: 1px solid #f2f2f2; text-decoration: none !important; }
.mnotif-item:hover { background: #f6fafb; }
.mnotif-title { display: block; color: #2c4254; font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mnotif-text  { display: block; color: #888; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.mnotif-empty { padding: 26px 16px; text-align: center; color: #999; font-size: 13px; }
.mnotif-empty i { display: block; font-size: 22px; margin-bottom: 8px; }
.mnotif-all {
    display: block; text-align: center; padding: 11px; font-size: 13px; font-weight: 700;
    color: var(--md-accent) !important; background: #f8f9fa; border-radius: 0 0 14px 14px; text-decoration: none !important;
}
.mnotif-badge:empty { display: none; }

/* ================= Desktop top bar: keep it on one line ================= */
@media (min-width: 992px) {
    /* menu titles never wrap to two lines */
    .navbar .navbar-nav .nav-link,
    .navbar .navItem__link { white-space: nowrap; }

    /* search box: input + square button side by side */
    .navbar__search-form .form-row { flex-wrap: nowrap; margin: 0; }
    .navbar__search-form .form-row > .col-10 { flex: 1 1 auto; max-width: none; width: auto; padding: 0; }
    .navbar__search-form .form-row > .col-2 { flex: 0 0 40px; max-width: 40px; padding: 0; }
    .navbar__search-form_input { width: 200px; height: 38px; }
    .navbar__search-form_button {
        width: 40px; height: 38px; padding: 0 !important; line-height: 1 !important;
        display: flex; align-items: center; justify-content: center;
    }
}

/* smaller laptops / tablets in landscape: make everything a bit tighter */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .navbar > .container-fluid { padding-right: 15px; padding-left: 15px; }
    .navbar-expand-lg .navbar-nav .nav-link,
    .navbar .navItem__link { font-size: 13px; padding-right: .4rem; padding-left: .4rem; }
    .navbar-right > li { padding: 0 2px; }
    .navbar-left .nav-item.mx-3 { margin-right: .4rem !important; margin-left: .4rem !important; }
    .navbar__search-form_input { width: 140px; }
}

/* bell must stay visible on small phones (global.css hides .notifications under 400px) */
@media (max-width: 991.98px) {
    .mnotif .notifications { display: inline-block !important; }
}

/* ================= Mobile / tablet top bar: one size for everything ================= */
@media (max-width: 991.98px) {
    .navbar > .container-fluid { min-height: 56px; padding-right: 10px; padding-left: 10px; }
    .mobileRightIcons, .mobileLeftIcons { display: flex; align-items: center; }

    /* all buttons (menu, bell, cart) = same 40x40 box */
    .navbar .navbar-toggler,
    .mobileLeftIcons .icons,
    .mnotif > a.icons {
        width: 40px; height: 40px; padding: 0 !important; margin: 0 2px !important;
        display: inline-flex !important; align-items: center; justify-content: center;
        border: 0 !important; border-radius: 10px; background: transparent !important;
        color: rgba(255,255,255,.8) !important; position: relative;
    }

    /* all icons = same size */
    .mobileLeftIcons .icons i,
    .mobileLeftIcons .icons .fas,
    .mobileLeftIcons .icons .fa {
        font-size: 19px !important; line-height: 1 !important;
        min-width: 0 !important; margin: 0 !important;
    }
    .navbar .navbar-toggler-icon { width: 26px; height: 26px; }

    /* both badges (cart + bell) look the same */
    .mobileLeftIcons .icons .badge,
    .mnotif-badge {
        position: absolute !important; top: 2px !important; right: 0 !important;
        min-width: 17px; height: 17px; line-height: 17px; padding: 0 4px !important;
        border-radius: 9px; font-size: 10px !important; text-align: center;
    }

    /* logo: 126px wide, shrinks (keeping its shape) if there is not enough room */
    .navbar .md-center-logo .nav_logo {
        width: 126px !important; max-width: 100% !important; height: auto !important;
    }

    /* equal distance from both screen edges:
       the icon buttons have empty space inside, so pull them toward the edge */
    .mobileRightIcons .navbar-toggler { margin-right: -7px !important; }
    .mobileLeftIcons > .icons:last-child { margin-left: -10px !important; }
}

/* ---- swipe gestures ---- */
.md-head { justify-content: center; }
.md-drawer { touch-action: pan-y; }
body.md-dragging .md-drawer,
body.md-dragging .md-overlay { transition: none !important; }

/* ---- user panel menu inside the drawer ---- */
.md-panel-menu .md-ico { width: 22px; margin-left: 10px; text-align: center; color: var(--md-accent); font-size: 15px; }
.md-panel-menu .md-link.md-active { background: var(--md-accent); color: #fff !important; }
.md-panel-menu .md-link.md-active .md-ico { color: #fff; }
.md-panel-menu .md-sub .md-link.md-active { background: rgba(31,182,209,.18); color: var(--md-accent) !important; }
.md-count {
    min-width: 20px; height: 20px; line-height: 20px; padding: 0 6px; border-radius: 10px;
    background: #ffc107; color: #222; font-size: 11px; font-weight: 700; text-align: center;
}

/* desktop: categories that don't fit wrap to a 2nd line, and the script hides them */
@media (min-width: 992px) {
    #navbarToggler > .navbar-nav.navbar-right { flex-wrap: wrap; min-width: 0; }
}

/* "دسته‌بندی‌ها" title row with "مشاهده همه" link on the left */
.md-title { display: flex; align-items: center; justify-content: space-between; }
.md-title-link { color: var(--md-muted) !important; font-size: 12px; text-decoration: none !important; }
.md-title-link:hover, .md-title-link:active { color: var(--md-accent) !important; }

/* never allow sideways scrolling of the whole page
   (some parts, e.g. carousels, are too wide for a moment until their script runs) */
html, body { overflow-x: hidden; }
@supports (overflow-x: clip) {
    html, body { overflow-x: clip; }   /* modern browsers: same result, keeps sticky elements working */
}
