/* ============================================================
   1) فونت سفارشی (IRANSansWebFaNum)
   ============================================================ */
/* ============================================================
   2) پنل کاربری (prefix: up-)
   ============================================================ */

/* ---------- 2-1) تنظیم box-sizing برای همه عناصر پنل ---------- */
.up-shell, .up-shell *, .up-shell *::before, .up-shell *::after,
.up-admin-tickets, .up-admin-tickets *, .up-admin-tickets *::before, .up-admin-tickets *::after {
    box-sizing: border-box;
}

/* ---------- 2-2) کانتینر اصلی پنل (shell) ---------- */
.up-shell {
    display: flex; /* ساید بار اولین فرزند است و در حالت rtl سمت راست می‌نشیند */
    min-height: 100vh;
    background: #f3f4f8;
    font-family: var(--font-main);
    color: #1f2937;
}

/* ============================================================
   3) ساید بار (Sidebar)
   ============================================================ */
.up-sidebar {
    width: 290px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1.25rem 1rem;
    background: linear-gradient(180deg, #052767 0%, #3a0647 100%);
    color: #fff;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

/* ---------- 3-1) پروفایل کاربر در سایدبار ---------- */
.up-profile {
    background: rgba(255, 255, 255, .1);
    border-radius: 14px;
    padding: 1rem;
    text-align: center;
}

.up-avatar {
    position: relative;
    width: 96px;
    height: 96px;
    margin: 0 auto .75rem;
    border-radius: 50%;
    overflow: hidden;
    background: #6d28d9;
    border: 3px solid rgba(255, 255, 255, .6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
}

    .up-avatar img {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.up-profile-name {
    font-size: 1.1rem;
    margin: 0 0 .6rem;
}

.up-profile-info {
    margin: 0 0 .8rem;
    text-align: start;
    font-size: .85rem;
}

    .up-profile-info dt {
        color: rgba(255, 255, 255, .65);
        margin-top: .5rem;
    }

    .up-profile-info dd {
        margin: 0;
        word-break: break-all;
    }

.up-form {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    text-align: start;
}

.up-profile .up-label {
    color: rgba(255, 255, 255, .85);
}

.up-profile .up-muted {
    color: rgba(255, 255, 255, .65);
}

/* ---------- 3-2) منوی ناوبری سایدبار ---------- */
.up-nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
}

.up-nav-link {
    display: block;
    padding: .65rem .9rem;
    border-radius: 10px;
    color: rgba(255, 255, 255, .85) !important;
    text-decoration: none;
    transition: background .15s;
}

    .up-nav-link:hover {
        background: rgba(255, 255, 255, .12);
    }

    .up-nav-link.active {
        background: rgba(255, 255, 255, .22);
        color: #fff !important;
        font-weight: 700;
    }

.up-logout-form {
    margin-top: auto;
}

/* ============================================================
   4) بدنه اصلی (Main)
   ============================================================ */
.up-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    color: #111827;
    line-height: 1.65;
}

/* ---------- 4-1) نوار بالا (Topbar) ---------- */
.up-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    height: 3.75rem;
    padding: 0 1.5rem;
    background: #fff;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.up-topbar-title {
    font-weight: 700;
    color: white;
    font-size: 1.05rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.up-topbar-link {
    color: #6d28d9;
    font-weight: 600;
    text-decoration: none;
    padding: .35rem .6rem;
    border-radius: 8px;
    transition: background .18s ease, color .18s ease;
}

    .up-topbar-link:hover {
        background: #ede9fe;
        color: #5b21b6;
    }

    .up-topbar-link:focus-visible {
        outline: 2px solid #6d28d9;
        outline-offset: 2px;
    }

/* ---------- 4-2) محتوای اصلی (Content) ---------- */
.up-content {
    padding: 1.5rem;
    max-width: 1000px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.up-title {
    font-size: 1.4rem;
    line-height: 1.4;
    margin: 0 0 .8rem;
    color: white;
    font-weight: 700;
}

    .up-title:focus {
        outline: none;
    }

.up-muted {
    color: #6b7280;
    font-size: .85rem;
}

.up-back {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    margin-bottom: .8rem;
    color: #6d28d9;
    text-decoration: none;
    font-weight: 500;
    transition: color .18s ease, transform .18s ease;
}

    .up-back:hover {
        color: #5b21b6;
        transform: translateX(-2px);
    }

/* ============================================================
   5) کارت‌ها و فرم‌ها
   ============================================================ */
.up-card {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
    border: 1px solid rgba(15, 23, 42, .04);
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    transition: box-shadow .18s ease;
}

    .up-card:hover {
        box-shadow: 0 10px 30px rgba(15, 23, 42, .10);
    }

.up-card-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: white;
}

/* ---------- 5-1) برچسب‌ها (Labels) ---------- */
.up-label {
    font-size: .85rem;
    font-weight: 500;
    margin-top: .3rem;
    color: #111827;
}

/* ---------- 5-2) ورودی‌ها (Inputs) ---------- */
.up-input {
    width: 100%;
    padding: .6rem .8rem;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
    background: #fff;
    color: #111827;
    box-sizing: border-box;
    transition: border-color .18s ease, box-shadow .18s ease;
}

    .up-input::placeholder {
        color: #9ca3af;
    }

    .up-input:hover:not(:disabled) {
        border-color: #b8bcc6;
    }

    .up-input:focus {
        outline: none;
        border-color: #6d28d9;
        box-shadow: 0 0 0 3px rgba(109, 40, 217, .15);
    }

    .up-input:disabled {
        background: #f3f4f6;
        color: #6b7280;
        cursor: not-allowed;
    }

textarea.up-input {
    resize: vertical;
    min-height: 90px;
    line-height: 1.6;
}

/* ---------- 5-3) پیام‌های خطا (Errors) ---------- */
.up-error,
.validation-message.up-error {
    color: #dc2626;
    font-size: .8rem;
    display: block;
    margin-top: .2rem;
}

.up-content .up-error {
    color: #dc2626;
}

/* ---------- 5-4) ردیف‌ها (Rows) ---------- */
.up-row {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.up-row-between {
    justify-content: space-between;
    align-items: center;
}

/* ============================================================
   6) دکمه‌ها (Buttons)
   ============================================================ */
.up-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .55rem 1rem;
    border-radius: 9px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
    user-select: none;
    white-space: nowrap;
}

    .up-btn:focus-visible {
        outline: 2px solid #6d28d9;
        outline-offset: 2px;
    }

    .up-btn:active:not(:disabled) {
        transform: translateY(1px);
    }

    .up-btn:disabled {
        opacity: .55;
        cursor: not-allowed;
        transform: none;
    }

/* ---------- 6-1) اندازه‌ها و حالت‌های دکمه ---------- */
.up-btn-sm {
    padding: .35rem .75rem;
    font-size: .82rem;
}

.up-btn-block {
    width: 100%;
}

/* ---------- 6-2) دکمه اصلی (Primary) ---------- */
.up-btn-primary {
    background: #6d28d9;
    color: #fff;
    box-shadow: 0 2px 6px rgba(109, 40, 217, .25);
}

    .up-btn-primary:hover:not(:disabled) {
        background: #5b21b6;
    }

/* ---------- 6-3) دکمه خطر (Danger) ---------- */
.up-btn-danger {
    background: #dc2626;
    color: #fff;
    box-shadow: 0 2px 6px rgba(220, 38, 38, .22);
}

    .up-btn-danger:hover:not(:disabled) {
        background: #b91c1c;
    }

/* ---------- 6-4) دکمه خطی (Outline) ---------- */
.up-btn-outline {
    background: transparent;
    border-color: currentColor;
    color: #6d28d9;
}

    .up-btn-outline:hover:not(:disabled) {
        background: #ede9fe;
    }

/* ---------- 6-5) دکمه خطی داخل سایدبار ---------- */
.up-sidebar .up-btn-outline {
    color: #fff;
    border-color: rgba(255, 255, 255, .6);
}

    .up-sidebar .up-btn-outline:hover:not(:disabled) {
        background: rgba(255, 255, 255, .12);
    }

/* ============================================================
   7) هشدارها (Alerts)
   ============================================================ */
.up-alert {
    padding: .7rem .9rem;
    border-radius: 8px;
    background: #eef2ff;
    font-size: .88rem;
    border: 1px solid transparent;
    line-height: 1.5;
}

.up-alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.up-alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* ============================================================
   8) بج‌ها (Badges)
   ============================================================ */
.up-badge {
    display: inline-flex;
    align-items: center;
    padding: .2rem .65rem;
    border-radius: 999px;
    font-size: .78rem;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.4;
}

.up-badge-success {
    background: #dcfce7;
    color: #166534;
}

.up-badge-warn {
    background: #fef3c7;
    color: #92400e;
}

.up-badge-muted {
    background: #e5e7eb;
    color: #4b5563;
}

/* ============================================================
   9) حالت خالی (Empty State)
   ============================================================ */
.up-empty {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    background: #fff;
    border-radius: 16px;
    border: 1px dashed #d1d5db;
    font-size: .92rem;
}

/* ============================================================
   10) لیست‌ها (Lists)
   ============================================================ */
.up-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 1rem;
}

/* ============================================================
   11) آدرس‌ها (Addresses)
   ============================================================ */
.up-addr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.15rem;
    background: #fff;
    border: 1.5px solid #e5e7eb;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.25s ease, transform 0.2s ease;
    will-change: transform, box-shadow;
}

    .up-addr:hover {
        border-color: #c4b5fd;
        box-shadow: 0 4px 12px rgba(124, 58, 237, 0.08);
        transform: translateY(-2px);
    }

    .up-addr:focus-within {
        outline: none;
        border-color: #c4b5fd;
        box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.25);
    }

.up-addr-active {
    background: #ecfdf5;
    border-color: #10b981;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12);
}

    .up-addr-active:hover {
        border-color: #10b981;
        box-shadow: 0 6px 18px rgba(16, 185, 129, 0.18);
    }

.up-addr-body {
    min-width: 0;
    flex: 1;
}

    .up-addr-body p {
        margin: 0.3rem 0 0;
        word-break: break-word;
        line-height: 1.55;
        color: #374151;
    }

.up-addr-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
}

@media (prefers-reduced-motion: reduce) {
    .up-addr {
        transition: border-color 0.2s ease, background-color 0.2s ease;
    }

        .up-addr:hover {
            transform: none;
        }
}

/* ============================================================
   12) تیکت‌ها (Tickets)
   ============================================================ */
.up-ticket {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: .8rem 1rem;
    color: inherit;
    text-decoration: none;
    text-align: start;
    font: inherit;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}

    .up-ticket:hover {
        border-color: #c4b5fd;
        background: #faf5ff;
        box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    }

    .up-ticket:focus-visible {
        outline: 2px solid #6d28d9;
        outline-offset: 2px;
    }

.up-ticket-selected {
    border-color: #6d28d9;
    background: #faf5ff;
    box-shadow: 0 0 0 3px rgba(109, 40, 217, .12);
}

.up-ticket > div {
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 0;
}

/* ============================================================
   13) چت (Chat)
   ============================================================ */
.up-chat {
    display: flex;
    flex-direction: column;
    gap: .75rem;
    margin-bottom: 1rem;
    padding: .5rem 0;
}

.up-msg {
    max-width: 85%;
    padding: .7rem .95rem;
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    line-height: 1.6;
    word-break: break-word;
    animation: up-fade-in .2s ease-out;
}

    .up-msg p {
        margin: .3rem 0 0;
        white-space: pre-wrap;
    }

.up-msg-head {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: .78rem;
    color: #6b7280;
    font-weight: 500;
}

.up-msg-user {
    align-self: flex-start;
    background: #ede9fe;
    border-end-end-radius: 4px;
}

.up-msg-admin {
    align-self: flex-end;
    background: #dbeafe;
    border-end-start-radius: 4px;
}

/* ---------- 13-1) انیمیشن ظاهر شدن پیام ---------- */
@keyframes up-fade-in {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   14) گرید ادمین تیکت‌ها (Admin Tickets Grid)
   ============================================================ */
.up-admin-tickets {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr);
    gap: 1rem;
    align-items: start;
}

/* ============================================================
   15) ریسپانسیو (Responsive)
   ============================================================ */
@media (max-width: 900px) {
    .up-admin-tickets {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .up-topbar {
        height: 3.25rem;
        padding: 0 1rem;
    }

    .up-topbar-title {
        font-size: .95rem;
    }

    .up-content {
        padding: 1rem;
    }

    .up-title {
        font-size: 1.2rem;
    }

    .up-card {
        padding: 1rem;
        border-radius: 12px;
    }

    .up-addr {
        flex-direction: column;
        align-items: stretch;
    }

    .up-addr-actions {
        justify-content: flex-end;
    }

    .up-ticket {
        flex-direction: column;
        align-items: stretch;
    }

    .up-msg {
        max-width: 95%;
    }

    .up-row-between {
        align-items: stretch;
    }

        .up-row-between > .up-btn,
        .up-row-between > a.up-btn {
            width: 100%;
        }

    .up-btn {
        padding: .6rem 1rem;
    }
}

/* ============================================================
   16) دسترس‌پذیری (Accessibility)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    .up-main *,
    .up-main *::before,
    .up-main *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   17) اسکرول‌بار نازک (فقط داخل up-main)
   ============================================================ */
.up-main ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.up-main ::-webkit-scrollbar-track {
    background: transparent;
}

.up-main ::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 999px;
    border: 2px solid #f9fafb;
}

    .up-main ::-webkit-scrollbar-thumb:hover {
        background: #9ca3af;
    }

/* ============================================================
   18) جدول و سبد خرید (Table & Cart)
   ============================================================ */
.up-table-wrap {
    overflow-x: auto;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
}

.up-table {
    width: 100%;
    border-collapse: collapse;
}

    .up-table th, .up-table td {
        padding: .7rem .9rem;
        text-align: start;
        border-bottom: 1px solid #f0f0f5;
    }

    .up-table th {
        background: #f9fafb;
        font-size: .85rem;
    }

.up-cart-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: #fff;
    border-radius: 12px;
    padding: .8rem 1rem;
    box-shadow: 0 2px 8px rgba(15, 23, 42, .06);
}

.up-cart-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .2rem;
    min-width: 140px;
}

.up-qty {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.up-cart-summary {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: #fff;
    border-radius: 12px;
    font-size: 1.05rem;
}

/* ============================================================
   19) صفحه‌ی اصلی (Home / Dashboard)
   ============================================================ */
.up-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.up-stat {
    display: flex;
    flex-direction: column;
    gap: .3rem;
    padding: 1rem;
    background: #fff;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 14px rgba(15, 23, 42, .08);
    transition: transform .15s;
}

    .up-stat:hover {
        transform: translateY(-2px);
    }

.up-stat-icon {
    font-size: 1.6rem;
}

.up-stat-label {
    color: #6b7280;
    font-size: .85rem;
}

.up-stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #3a0647;
}

.up-stat-text {
    font-size: .95rem;
    font-weight: 600;
}

/* ============================================================
   20) موبایل (Mobile - max-width: 800px)
   ============================================================ */
@media (max-width: 800px) {
    .up-shell {
        flex-direction: column;
    }

    .up-sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .up-admin-tickets {
        grid-template-columns: 1fr;
    }

    .up-msg {
        max-width: 100%;
    }

    .up-addr {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ============================================================
   21) فرم ثبت تیکت: انتخاب موضوع (دکمه‌های رادیویی)، خطای فیلد و شمارنده
   ============================================================ */
.up-form-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.up-field {
    display: flex;
    flex-direction: column;
    gap: .4rem;
    min-width: 0;
}

    .up-field > .up-label {
        margin-top: 0;
    }

.up-field-foot {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: .75rem;
}

.up-hint {
    color: #6b7280;
    font-size: .8rem;
    line-height: 1.7;
}

.up-count {
    flex-shrink: 0;
    color: #9ca3af;
    font-size: .78rem;
    font-variant-numeric: tabular-nums;
}

/* ---------- 21-1) گروه دکمه‌های رادیویی (کپسولی) ---------- */
.up-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.up-radio {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 999px;
    background: #fff;
    color: #374151;
    font-size: .9rem;
    cursor: pointer;
    user-select: none;
    transition: border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

    /* دایره‌ی رادیو: خودِ input نامرئی روی کل کپسول می‌نشیند تا کلیک و فوکوس صفحه‌کلید سالم بماند */
    .up-radio::before {
        content: "";
        flex-shrink: 0;
        width: 1rem;
        height: 1rem;
        border: 2px solid #9ca3af;
        border-radius: 50%;
        background: #fff;
        box-sizing: border-box;
        transition: border-color .18s ease, background .18s ease;
    }

    .up-radio input {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        margin: 0;
        opacity: 0;
        cursor: pointer;
    }

    .up-radio:hover {
        border-color: #c4b5fd;
        background: #faf5ff;
    }

    .up-radio.is-checked {
        border-color: #6d28d9;
        background: rgba(109, 40, 217, .08);
        color: #3a0647;
        font-weight: 600;
    }

        .up-radio.is-checked::before {
            border-color: #6d28d9;
            background: radial-gradient(circle, #6d28d9 0 40%, #fff 45%);
        }

    .up-radio:focus-within {
        box-shadow: 0 0 0 3px rgba(109, 40, 217, .2);
    }

    .up-radio:has(input:disabled) {
        opacity: .6;
        cursor: not-allowed;
    }

        .up-radio:has(input:disabled) input {
            cursor: not-allowed;
        }

/* ---------- 21-2) حالت خطای ورودی ---------- */
.up-input.is-invalid {
    border-color: #dc2626;
    background: #fff7f7;
}

    .up-input.is-invalid:focus {
        box-shadow: 0 0 0 3px rgba(220, 38, 38, .15);
    }

@media (max-width: 640px) {
    .up-radio-group {
        flex-direction: column;
    }

    .up-radio {
        width: 100%;
        border-radius: 12px;
        padding: .65rem .9rem;
    }

    .up-field-foot {
        flex-direction: column;
        gap: .2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .up-radio,
    .up-radio::before {
        transition: none;
    }
}

/* ============================================================
   22) موبایل — ظاهر «اپلیکیشنی» پنل کاربری (≤ 800px، مثلاً Galaxy S22 با عرض CSS = 360)
   ------------------------------------------------------------
   - دسکتاپ (> 800px) هیچ تغییری نمی‌کند: ساید‌بار و نوار بالای قبلی همان‌طور می‌مانند.
   - پس‌زمینه: همان تصویر پنل ادمین (/ShahrzadLashAcademy/Images/background.webp) در یک لایه‌ی fixed جدا
     (background-attachment: fixed در مرورگرهای موبایل کند و پرش‌دار است).
   - نوار بالا (شیشه‌ای، sticky): راست برگر منو ← وسط عنوان ← چپ عکس کاربر.
   - نوار پایین (شیشه‌ای، fixed): از راست سبد خرید، آدرس، تیکت، خانه (آیکن + نوشته).
   - اهداف لمسی حداقل 44×44 پیکسل؛ فاصله‌ها با safe-area دستگاه‌های دارای ناچ هماهنگ‌اند.
   ============================================================ */

/* در دسکتاپ اجزای موبایل اصلاً دیده نمی‌شوند */
.up-mtop,
.up-mnav,
.up-mbackdrop {
    display: none;
}

.up-ico {
    width: 1.35rem;
    height: 1.35rem;
    flex-shrink: 0;
}

@media (max-width: 800px) {

    /* ---------- 22-1) پس‌زمینه و قاب کلی ---------- */
    .up-shell {
        position: relative;
        isolation: isolate;
        flex-direction: column;
        min-height: 100vh;
        min-height: 100dvh;
        width: 100%;
        max-width: 100%;
        overflow-x: clip; /* هیچ چیز نباید صفحه را افقی بزرگ‌تر کند */
        background: transparent;
        -webkit-tap-highlight-color: transparent;
    }

        .up-shell::before {
            content: "";
            position: fixed;
            inset: 0;
            z-index: -1;
            pointer-events: none;
            background: #04204a url(/ShahrzadLashAcademy/Images/background.webp) center / cover no-repeat;
        }

    /* ساید‌بار و نوار بالای دسکتاپ در موبایل جایشان را به نوارهای جدید می‌دهند */
    .up-sidebar,
    .up-topbar {
        display: none;
    }

    .up-main {
        background: transparent;
        min-height: 100vh;
        min-height: 100dvh;
        /* جا برای نوار پایین تا آخر محتوا زیر آن نرود */
        padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
    }

    /* قاب دور محتوا (هم‌سبک کادر محتوای پنل ادمین) */
    .up-content {
        width: auto;
        max-width: none;
        min-width: 0;
        margin: .5rem;
        padding: .9rem;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, .6);
        box-shadow: 0 14px 40px rgba(0, 10, 30, .30), inset 0 1px 0 rgba(255, 255, 255, .8);
    }

    /* ---------- 22-2) نوار بالا ---------- */
    .up-mtop {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .5rem;
        position: sticky;
        top: calc(.5rem + env(safe-area-inset-top, 0px));
        z-index: 1040; /* بالاتر از محتوا و نوار پایین، پایین‌تر از مودال‌ها (1050) */
        min-height: 3.5rem;
        margin: .5rem .5rem 0;
        padding: .3rem .5rem;
        background: rgba(255, 255, 255, .84);
        -webkit-backdrop-filter: blur(14px) saturate(140%);
        backdrop-filter: blur(14px) saturate(140%);
        border: 1px solid rgba(255, 255, 255, .6);
        border-radius: 18px;
        box-shadow: 0 8px 26px rgba(0, 10, 30, .26), inset 0 1px 0 rgba(255, 255, 255, .8);
    }

    .up-mtop-title {
        flex: 1 1 auto;
        min-width: 0;
        text-align: center;
        font-size: 1rem;
        font-weight: 700;
        color: #053d67;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .up-mtop-end {
        display: inline-flex; /* عمداً position ندارد تا منوی کاربر نسبت به کل نوار بالا چیده شود */
        flex-shrink: 0;
    }

    /* دکمه‌های گرد نوار بالا: هدف لمسی 44×44 */
    .up-mbtn {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        width: 2.75rem;
        height: 2.75rem;
        padding: 0;
        font: inherit;
        color: #0e7490;
        background: rgba(14, 116, 144, .10);
        border: 1px solid rgba(14, 116, 144, .22);
        border-radius: 14px;
        cursor: pointer;
        touch-action: manipulation;
        transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    }

        .up-mbtn:active {
            transform: scale(.94);
        }

        .up-mbtn:focus-visible,
        .up-mmenu-link:focus-visible,
        .up-pm-item:focus-visible,
        .up-mnav-item:focus-visible {
            outline: 2px solid #22d3ee;
            outline-offset: 2px;
        }

        .up-mbtn.is-open {
            background: rgba(14, 116, 144, .20);
            box-shadow: 0 0 0 3px rgba(34, 211, 238, .28);
        }

    /* برگر (سه خط) که هنگام باز بودن منو به ضربدر تبدیل می‌شود */
    .up-burger {
        flex-direction: column;
        gap: 5px;
    }

    .up-burger-bar {
        display: block;
        width: 1.25rem;
        height: 2px;
        border-radius: 2px;
        background: currentColor;
        transition: transform .25s ease, opacity .2s ease;
    }

    .up-burger.is-open .up-burger-bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .up-burger.is-open .up-burger-bar:nth-child(2) {
        opacity: 0;
    }

    .up-burger.is-open .up-burger-bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    /* عکس گرد کاربر (هم‌سبک عکس بالای پنل ادمین) */
    .up-pm-btn {
        border-radius: 50%;
        background: transparent;
        border: 0;
    }

    .up-pm-avatar {
        position: relative;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 2.5rem;
        height: 2.5rem;
        border-radius: 50%;
        overflow: hidden;
        background: #cffafe;
        border: 2px solid #0e7490;
        box-shadow: 0 0 0 3px rgba(34, 211, 238, .28), 0 4px 12px rgba(14, 116, 144, .35);
        color: #0e7490;
        font-weight: 700;
    }

        .up-pm-avatar img {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 50%;
        }

    .up-pm-avatar--lg {
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.3rem;
        flex-shrink: 0;
    }

    /* ---------- 22-3) پس‌زمینه‌ی تیره‌ی پشت منوهای بازشو ---------- */
    .up-mbackdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1035;
        background: rgba(2, 12, 32, .5);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
        animation: up-mfade .2s ease both;
    }

    /* ---------- 22-4) منوهای بازشو (برگر + کاربر): شیشه‌ی تیره‌ی سرمه‌ای-فیروزه‌ای مثل منوی ادمین ---------- */
    .up-mmenu,
    .up-pm-menu {
        position: absolute;
        top: calc(100% + .5rem);
        padding: .5rem;
        max-height: calc(100dvh - 7.5rem);
        overflow-y: auto;
        overscroll-behavior: contain;
        color: #e8f6fb;
        background: linear-gradient(160deg, rgba(2, 26, 64, .97) 0%, rgba(5, 61, 103, .97) 60%, rgba(7, 87, 123, .97) 100%);
        border: 1px solid rgba(255, 255, 255, .18);
        border-radius: 18px;
        box-shadow: 0 18px 40px rgba(0, 10, 30, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
        animation: up-mpop .18s ease both;
    }

    .up-mmenu {
        inset-inline: 0;
    }

    .up-pm-menu {
        inset-inline-end: 0;
        width: min(19rem, 100%);
    }

    .up-mmenu-link,
    .up-pm-item {
        display: flex;
        align-items: center;
        gap: .75rem;
        width: 100%;
        min-height: 3rem;
        padding: .6rem .85rem;
        font: inherit;
        font-size: .95rem;
        text-align: start;
        text-decoration: none;
        color: #e8f6fb !important;
        background: transparent;
        border: 0;
        border-radius: 12px;
        cursor: pointer;
        touch-action: manipulation;
        transition: background .15s ease;
    }

        .up-mmenu-link:active,
        .up-pm-item:active {
            background: rgba(255, 255, 255, .14);
        }

        .up-mmenu-link.active {
            color: #fff !important;
            font-weight: 700;
            background: rgba(34, 211, 238, .18);
            box-shadow: inset 3px 0 0 #22d3ee;
        }

        .up-mmenu-link .up-ico,
        .up-pm-item .up-ico {
            color: #67e8f9;
        }

        /* نشان تعداد سبد خرید در انتهای ردیف */
        .up-mmenu-link .ct-badge {
            position: static;
            margin-inline-start: auto;
            flex-shrink: 0;
            color: #053d67;
            background: #fff;
            box-shadow: none;
        }

    .up-mmenu-sep {
        height: 1px;
        margin: .35rem .5rem;
        background: rgba(255, 255, 255, .16);
    }

    .up-pm-item--danger,
    .up-pm-item--danger .up-ico {
        color: #fecaca !important;
    }

    .up-pm-logout {
        margin: 0;
    }

    /* سرِ منوی کاربر: عکس، نام، ایمیل و موبایل */
    .up-pm-head {
        display: flex;
        align-items: center;
        gap: .75rem;
        padding: .6rem .6rem .8rem;
        margin-bottom: .35rem;
        border-bottom: 1px solid rgba(255, 255, 255, .16);
    }

    .up-pm-who {
        display: flex;
        flex-direction: column;
        gap: .1rem;
        min-width: 0;
    }

    .up-pm-name {
        font-size: 1rem;
        color: #fff;
        overflow-wrap: anywhere;
    }

    .up-pm-line {
        font-size: .8rem;
        color: #c3dcea;
        overflow-wrap: anywhere;
        text-align: start;
    }

    .up-pm-empty {
        margin: 0;
        padding: .75rem;
        font-size: .88rem;
        color: #c3dcea;
    }

    /* ---------- 22-5) نوار پایین ---------- */
    .up-mnav {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr)); /* ستون اول (سبد خرید) در RTL سمت راست است */
        gap: .25rem;
        position: fixed;
        z-index: 1030;
        inset-inline: .5rem;
        bottom: calc(.5rem + env(safe-area-inset-bottom, 0px));
        max-width: 32rem;
        margin-inline: auto;
        padding: .3rem;
        background: rgba(255, 255, 255, .88);
        -webkit-backdrop-filter: blur(14px) saturate(140%);
        backdrop-filter: blur(14px) saturate(140%);
        border: 1px solid rgba(255, 255, 255, .6);
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0, 10, 30, .38), inset 0 1px 0 rgba(255, 255, 255, .8);
    }

    .up-mnav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: .2rem;
        min-width: 0;
        min-height: 3.5rem;
        padding: .35rem .15rem;
        color: #3f566e;
        text-decoration: none;
        border-radius: 14px;
        touch-action: manipulation;
        transition: background .2s ease, color .2s ease, transform .15s ease;
    }

        .up-mnav-item:active {
            transform: scale(.95);
        }

        .up-mnav-item.active {
            color: #0e7490;
            background: rgba(14, 116, 144, .13);
            font-weight: 700;
        }

            .up-mnav-item.active .up-ico {
                stroke-width: 2.4;
            }

    .up-mnav-ico {
        position: relative;
        display: inline-flex;
    }

        /* نشان تعداد روی گوشه‌ی آیکن سبد خرید */
        .up-mnav-ico .ct-badge {
            top: -7px;
            inset-inline-end: -11px;
            min-width: 17px;
            height: 17px;
            padding: 0 4px;
            font-size: 10px;
        }

    .up-mnav-text {
        max-width: 100%;
        font-size: .72rem;
        font-weight: inherit;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ---------- 22-6) انیمیشن‌ها ---------- */
    @keyframes up-mpop {
        from {
            opacity: 0;
            transform: translateY(-6px) scale(.98);
        }

        to {
            opacity: 1;
            transform: none;
        }
    }

    @keyframes up-mfade {
        from {
            opacity: 0;
        }

        to {
            opacity: 1;
        }
    }
}

/* گوشی‌های باریک (≤ 360px مثل S22 و کوچک‌تر) */
@media (max-width: 380px) {
    .up-content {
        padding: .75rem;
        border-radius: 18px;
    }

    .up-mtop-title {
        font-size: .92rem;
    }

    .up-mnav-text {
        font-size: .68rem;
    }

    .up-pm-menu {
        width: 100%;
    }
}

/* گوشی در حالت افقی: ارتفاع کم است؛ نوار پایین را فشرده‌تر می‌کنیم */
@media (max-width: 800px) and (max-height: 480px) {
    .up-mnav-item {
        flex-direction: row;
        gap: .4rem;
        min-height: 2.75rem;
    }

    .up-main {
        padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .up-mmenu,
    .up-pm-menu,
    .up-mbackdrop,
    .up-burger-bar,
    .up-mbtn,
    .up-mnav-item {
        animation: none !important;
        transition: none !important;
    }
}

/* ============================================================
   23) صفحه‌ی اصلی پنل (فقط متن خوش‌آمد) و مودال ویرایش مشخصات
   ============================================================ */
.up-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
    padding: 1.5rem 0;
    text-align: center;
}

    .up-welcome .up-title {
        margin: 0;
    }

/* دستگیره‌ی کوچک بالای هدر مودال ویرایش (فقط موبایل): یادآوری می‌کند هدر با انگشت قابل جابه‌جایی است.
   خودِ درگ (ماوس + لمس) در GenericModal فعال است؛ هدر touch-action: none دارد تا صفحه همراهش اسکرول نشود. */
@media (max-width: 800px) {
    .profile-modal .modal-header::after {
        content: "";
        position: absolute;
        top: 6px;
        inset-inline: 0;
        margin-inline: auto;
        width: 2.5rem;
        height: 4px;
        border-radius: 4px;
        background: rgba(255, 255, 255, .35);
        pointer-events: none;
    }
}

/* ============================================================
   24) موبایل: دکمه‌ی شناور چت پشتیبانی در پنل کاربری دیده نشود
   ------------------------------------------------------------
   ویجت چت در App.razor و بیرون از لایوت پنل رندر می‌شود، پس با :has وقتی صفحه شامل پنل کاربری است مخفی می‌شود.
   (در پنل، «تیکت» برای ارتباط با پشتیبانی هست و دکمه‌ی شناور روی نوار پایین می‌افتاد.)
   ============================================================ */
@media (max-width: 800px) {
    body:has(.up-shell) .cb-root {
        display: none !important;
    }
}

/* ============================================================
   25) دسکتاپ (> 800px): همان پس‌زمینه‌ی تصویریِ پنل ادمین و موبایل
   ------------------------------------------------------------
   - تصویر در یک لایه‌ی fixed جدا (بدون پرش هنگام اسکرول)؛ چیدمان (ساید‌بار راست، نوار بالا، محتوا) عوض نمی‌شود.
   - ساید‌بار شیشه‌ای تیره، نوار بالا و قاب محتوا شیشه‌ای روشن (هم‌سبک پنل ادمین) تا متن‌ها خوانا بمانند.
   ============================================================ */
@media (min-width: 801px) {
    .up-shell {
        position: relative;
        isolation: isolate;
        background: transparent;
    }

        .up-shell::before {
            content: "";
            position: fixed;
            inset: 0;
            z-index: -1;
            pointer-events: none;
            background: #04204a url(/ShahrzadLashAcademy/Images/background.webp) center / cover no-repeat;
        }

    .up-sidebar {
        background:
            radial-gradient(120% 35% at 50% 0%, rgba(255, 255, 255, .16), transparent 65%),
            linear-gradient(180deg, rgba(2, 26, 64, .78) 0%, rgba(5, 61, 103, .62) 55%, rgba(14, 116, 144, .56) 100%);
        border-inline-end: 1px solid rgba(255, 255, 255, .16);
        box-shadow: inset 1px 0 0 rgba(255, 255, 255, .08), 0 10px 40px rgba(0, 10, 30, .45);
        -webkit-backdrop-filter: blur(18px) saturate(140%);
        backdrop-filter: blur(18px) saturate(140%);
    }

    .up-main {
        background: transparent;
    }

    .up-topbar {
        top: .75rem;
        height: 3.5rem;
        margin: .75rem 1.5rem 0;
        padding: 0 1.25rem;
        background: rgba(255, 255, 255, .82);
        -webkit-backdrop-filter: blur(14px) saturate(140%);
        backdrop-filter: blur(14px) saturate(140%);
        border: 1px solid rgba(255, 255, 255, .6);
        border-radius: 18px;
        box-shadow: 0 8px 26px rgba(0, 10, 30, .26), inset 0 1px 0 rgba(255, 255, 255, .8);
    }

    .up-content {
        width: calc(100% - 3rem);
        margin: 1rem auto 1.5rem;
        padding: 1.5rem;
        border-radius: 20px;
        box-shadow: 0 14px 40px rgba(0, 10, 30, .30), inset 0 1px 0 rgba(255, 255, 255, .8);
    }
}
