
/* =========================================================
   Font Face: Estedad
========================================================= */

@font-face {
    font-family: 'Estedad';
    src:
        url('../fonts/Estedad-Medium.woff2') format('woff2'),
        url('../fonts/Estedad-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Estedad';
    src:
        url('../fonts/Estedad-Bold.woff2') format('woff2'),
        url('../fonts/Estedad-Bold.woff') format('woff');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* =========================================================
   Variables
========================================================= */

:root {
    --bg-dark: #121212;
    --card-dark: #1e1e1e;
    --border-dark: #2d2d2d;
    --text-primary: #ffffff;
    --text-secondary: #aaaaaa;
    --accent-color: #ff9800;
    --accent-hover: #e68a00;
    --danger-color: #f44336;
    --drawer-bg: #1c1c1e;
}

/* =========================================================
   Base
========================================================= */

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Estedad', Tahoma, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

body.menu-dark {
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

body.drawer-is-open {
    overflow: hidden;
}

body,
button,
input,
select,
textarea {
    font-family: 'Estedad', Tahoma, sans-serif !important;
    -webkit-font-smoothing: antialiased;
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

/* =========================================================
   Header / Navigation
========================================================= */

.menu-header-nav {
    position: relative;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-dark);
    margin-bottom: 20px;
    overflow: visible;
}

.back-btn {
    color: var(--text-primary);
    text-decoration: none;
    font-size: 15px;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--accent-color);
}

.header-actions {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
    overflow: visible;
}

.action-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 10px;
    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.3s,
        transform 0.2s;
}

.action-btn:hover {
    background: var(--border-dark);
}

.action-btn:active {
    transform: scale(0.96);
}

.action-btn:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 3px;
}

.action-icon {
    width: 30px !important;
    height: 30px !important;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background-color: var(--danger-color);
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    border-radius: 50%;
    pointer-events: none;
}

/* =========================================================
   Language Dropdown — Click Only
========================================================= */

.lang-switch-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    overflow: visible;
}

/*
 * در حالت عادی dropdown کاملاً مخفی است.
 * هیچ قانون hover برای باز کردن آن وجود ندارد.
 */
.lang-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    z-index: 10000;

    display: block;
    min-width: 155px;
    padding: 6px 0;

    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transform: translateY(-6px);
    transition:
        opacity 0.18s ease,
        visibility 0.18s ease,
        transform 0.18s ease;
}

/*
 * dropdown فقط با اضافه شدن کلاس active از طریق JavaScript باز می‌شود.
 */
.lang-switch-container.active .lang-dropdown {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.lang-dropdown a {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;

    color: var(--text-primary);
    text-decoration: none;
    font-size: 13px;
    line-height: 1.5;
    white-space: nowrap;

    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;

    transition:
        background-color 0.2s,
        color 0.2s;
}

.lang-dropdown a:hover,
.lang-dropdown a:focus-visible,
.lang-dropdown a.active {
    background: var(--border-dark);
    color: var(--accent-color);
}

.lang-dropdown a:focus-visible {
    outline: none;
}

.lang-flag {
    width: 22px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
    flex: 0 0 auto;
    pointer-events: none;
}

/*
 * جهت متن گزینه‌ها
 */
html[dir="rtl"] .lang-dropdown a {
    text-align: right;
}

html[dir="ltr"] .lang-dropdown a {
    text-align: left;
}

/*
 * عمداً هیچ‌کدام از قوانین زیر نباید در فایل وجود داشته باشند:

 * .lang-switch-container:hover .lang-dropdown
 * .lang-trigger:hover + .lang-dropdown
 */

/* =========================================================
   Topbar
========================================================= */

.topbar h1 {
    margin-top: 0;
    color: var(--text-primary);
}

/* =========================================================
   Main Layout
========================================================= */

.menu-layout-wrapper {
    display: flex;
    gap: 25px;
    margin-top: 20px;
    align-items: flex-start;
}

/* RTL / LTR */

html[dir="rtl"] .menu-layout-wrapper {
    flex-direction: row;
}

html[dir="ltr"] .menu-layout-wrapper {
    flex-direction: row-reverse;
}

/* =========================================================
   Sidebar Categories
========================================================= */

.category-sidebar {
    position: sticky;
    top: 20px;
    width: 100px;
    height: calc(100vh - 20px);
    flex-shrink: 0;
    overflow-y: auto;
    scrollbar-width: none;
}

.category-sidebar::-webkit-scrollbar {
    display: none;
}

.sidebar-sticky {
    position: sticky;
    top: 20px;
    padding: 15px 5px;
    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
}

.sidebar-sticky h3 {
    display: none;
}

.category-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.category-links li {
    width: 100%;
}

.category-item-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    text-decoration: none;
    transition: transform 0.2s;
}

.category-item-link:hover {
    transform: scale(1.05);
}

.category-icon-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 65px;
    height: 65px;
    padding: 5px;
    overflow: hidden;
    background: #2a2a2a;
    border: 2px solid #333333;
    border-radius: 50%;
    transition:
        border-color 0.3s,
        transform 0.2s;
}

.category-item-link:hover .category-icon-wrapper,
.category-item-link.active .category-icon-wrapper {
    border-color: var(--accent-color);
}

.category-icon-wrapper img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.category-name {
    display: block;
    max-width: 85px;
    overflow: hidden;
    color: #ffffff;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* =========================================================
   Main Content
========================================================= */

.menu-main-content {
    flex-grow: 1;
    min-width: 0;
}

.category-section {
    margin-bottom: 40px;
}

.category-title {
    margin-bottom: 20px;
    padding-bottom: 8px;
    color: var(--accent-color);
    font-size: 20px;
    border-bottom: 2px solid var(--border-dark);
}

/* =========================================================
   Products Grid
========================================================= */

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

/* =========================================================
   Product Card
========================================================= */

.product-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--card-dark);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition:
        transform 0.2s,
        box-shadow 0.2s;
}

.product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
}

.product-card:active {
    transform: scale(0.98);
}

.product-image {
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #111111;
}

.product-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-content {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 8px;
    padding: 12px;
}

.product-title {
    margin: 0;
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: bold;
}

.product-desc {
    height: 3em;
    overflow: hidden;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.5;
}

.product-price-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.product-price {
    display: flex;
    align-items: center;
    gap: 4px;
    color: var(--accent-color);
    font-size: 1rem;
    font-weight: bold;
    white-space: nowrap;
}

.price-amount {
    font-size: 1.1rem;
}

.currency {
    font-size: 0.8rem;
    font-weight: normal;
    opacity: 0.9;
}

.add-to-notes-btn {
    padding: 6px 14px;
    background: var(--accent-color);
    color: #000000;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition:
        background 0.2s,
        transform 0.2s;
}

.add-to-notes-btn:hover {
    background: var(--accent-hover);
}

.add-to-notes-btn:active {
    transform: scale(0.96);
}

/* =========================================================
   Drawer / Overlay
========================================================= */

.drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.drawer-overlay.is-active {
    display: block;
}

.notes-drawer {
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    width: 320px;
    background: var(--drawer-bg);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s ease-in-out;
}

/* RTL Drawer */

html[dir="rtl"] .notes-drawer {
    left: 0;
    border-right: 1px solid var(--border-dark);
    transform: translateX(-100%);
}

html[dir="rtl"] .notes-drawer.is-open {
    transform: translateX(0);
}

/* LTR Drawer */

html[dir="ltr"] .notes-drawer {
    right: 0;
    border-left: 1px solid var(--border-dark);
    transform: translateX(100%);
}

html[dir="ltr"] .notes-drawer.is-open {
    transform: translateX(0);
}

/* Drawer Inner */

.drawer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-dark);
}

.drawer-header h2 {
    margin: 0;
    font-size: 18px;
}

.close-drawer-btn {
    padding: 0;
    background: none;
    color: var(--text-primary);
    border: none;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.drawer-body {
    flex-grow: 1;
    padding: 20px;
    overflow-y: auto;
}

.drawer-empty-message {
    padding: 40px 0;
    color: var(--text-secondary);
    text-align: center;
}

.drawer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-dark);
}

.drawer-item-img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
}

.drawer-item-details {
    flex-grow: 1;
    min-width: 0;
}

.drawer-item-title {
    margin: 0 0 5px;
    overflow: hidden;
    font-size: 14px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.drawer-item-price {
    color: var(--accent-color);
    font-size: 12px;
}

.drawer-qty-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.qty-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    background: var(--border-dark);
    color: var(--text-primary);
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
}

.qty-btn:hover {
    background: var(--accent-color);
    color: #000000;
}

.qty-val {
    min-width: 15px;
    font-size: 14px;
    text-align: center;
}

.drawer-footer {
    padding: 20px;
    background: var(--card-dark);
    border-top: 1px solid var(--border-dark);
}

.total-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    font-size: 16px;
}

.total-row strong {
    color: var(--accent-color);
}

.clear-all-btn {
    width: 100%;
    padding: 10px;
    background: var(--danger-color);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    touch-action: manipulation;
    transition: opacity 0.2s;
}

.clear-all-btn:hover {
    opacity: 0.9;
}

.notes-trigger-btn {
    position: relative;
}

.notes-trigger-btn .badge {
    top: -5px;
    right: -5px;
    padding: 2px 6px;
    font-size: 0.75rem;
}

/* =========================================================
   Responsive: Mobile
========================================================= */

@media (max-width: 768px) {
    .menu-header-nav {
        padding: 12px 0;
        margin-bottom: 14px;
    }

    .header-actions {
        gap: 14px;
    }

    .lang-dropdown {
        top: calc(100% + 8px);
        min-width: 150px;
    }

    .lang-dropdown a {
        min-height: 44px;
        padding: 11px 14px;
    }

    .menu-layout-wrapper {
        gap: 12px;
        margin-top: 12px;
    }

    .category-sidebar {
        top: 10px;
        width: 78px;
        min-width: 78px;
        height: calc(100vh - 20px);
    }

    .sidebar-sticky {
        top: 10px;
        padding: 10px 5px;
        border-radius: 12px;
    }

    .category-links {
        gap: 12px;
    }

    .category-icon-wrapper {
        width: 52px;
        height: 52px;
        padding: 4px;
    }

    .category-name {
        max-width: 70px;
        font-size: 10px;
    }

    .products-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .product-card {
        flex-direction: row;
        align-items: stretch;
    }

    .product-image {
        width: 92px;
        height: auto;
        min-height: 92px;
        flex-shrink: 0;
    }

    .product-content {
        justify-content: space-between;
        gap: 6px;
        padding: 8px 10px;
    }

    .product-title {
        font-size: 14px;
    }

    .product-desc {
        height: auto;
        max-height: 36px;
        font-size: 11px;
        line-height: 1.45;
    }

    .product-price-action {
        margin-top: 0;
    }

    .product-price {
        font-size: 13px;
    }

    .add-to-notes-btn {
        padding: 5px 10px;
        border-radius: 8px;
        font-size: 11px;
    }

    .notes-drawer {
        width: 92%;
        max-width: 320px;
    }
}

/* =========================================================
   Extra Small Phones
========================================================= */

@media (max-width: 420px) {
    .menu-layout-wrapper {
        gap: 10px;
    }

    .category-sidebar {
        width: 72px;
        min-width: 72px;
    }

    .category-icon-wrapper {
        width: 48px;
        height: 48px;
    }

    .category-name {
        max-width: 64px;
        font-size: 9px;
    }

    .product-image {
        width: 84px;
        min-height: 84px;
    }

    .product-title {
        font-size: 13px;
    }

    .product-desc {
        max-height: 32px;
    }

    .header-actions {
        gap: 10px;
    }

    .action-btn {
        width: 42px;
        height: 42px;
    }

    .lang-dropdown {
        min-width: 145px;
    }
}

/* =========================================================
   Devices Without Real Hover
========================================================= */

@media (hover: none) and (pointer: coarse) {
    .action-btn:hover {
        background: var(--card-dark);
    }

    .lang-dropdown a:hover {
        background: transparent;
        color: var(--text-primary);
    }

    .lang-dropdown a.active {
        background: var(--border-dark);
        color: var(--accent-color);
    }

    .product-card:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    }

    .category-item-link:hover {
        transform: none;
    }

    .add-to-notes-btn:hover {
        background: var(--accent-color);
    }
}
.checkout-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.checkout-modal-content {
    background: #fff;
    width: 100%;
    max-width: 500px;
    border-radius: 16px;
    padding: 20px;
    direction: rtl;
}

.checkout-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.checkout-modal .form-group {
    margin-bottom: 15px;
}

.checkout-modal .form-control {
    width: 100%;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 10px 12px;
}

.submit-order-btn,
.checkout-btn {
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: #d4a017;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 10px;
}

.clear-all-btn {
    width: 100%;
    padding: 12px;
    border: 0;
    border-radius: 10px;
    background: #666;
    color: #fff;
    font-weight: bold;
    cursor: pointer;
}
/* =========================================================
   Checkout Modal
========================================================= */

.checkout-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99999;
}

.checkout-modal-content {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    background: #ffffff;
    color: #222222;
    border-radius: 18px;
    padding: 24px;
    direction: rtl;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.checkout-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 18px;
}

.checkout-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #111111;
}

.close-checkout-modal {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: #f1f1f1;
    color: #222;
    font-size: 20px;
    cursor: pointer;
    flex: 0 0 auto;
}

.close-checkout-modal:hover {
    background: #e5e5e5;
}

.checkout-modal .form-group {
    margin-bottom: 16px;
}

.checkout-modal label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #222222;
}

.checkout-modal .form-control,
.checkout-modal input,
.checkout-modal textarea,
.checkout-modal select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d6d6d6;
    border-radius: 10px;
    background: #fff;
    color: #222;
    font-size: 14px;
    outline: none;
}

.checkout-modal .form-control:focus,
.checkout-modal input:focus,
.checkout-modal textarea:focus,
.checkout-modal select:focus {
    border-color: #d4a017;
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
}

.checkout-modal textarea {
    min-height: 110px;
    resize: vertical;
}

.checkout-modal .form-control::placeholder,
.checkout-modal input::placeholder,
.checkout-modal textarea::placeholder {
    color: #999;
}

.checkout-modal .submit-order-btn {
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 10px;
    background: #d4a017;
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.checkout-modal .submit-order-btn:hover {
    background: #bf8f14;
}

.checkout-modal .submit-order-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

body.checkout-modal-open {
    overflow: hidden;
}
