/* پنل کاربری + سبد خرید */
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    flex-shrink: 0;
    user-select: none;
}
.user-avatar--sm { width: 36px; height: 36px; font-size: 0.95rem; }
.user-avatar--md { width: 48px; height: 48px; font-size: 1.15rem; }
.user-avatar--lg { width: 72px; height: 72px; font-size: 1.6rem; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

/* هدر — منوی کاربر */
.user-nav-menu { position: relative; z-index: 20; flex-shrink: 0; }
.user-nav-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px 4px 4px;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(12px);
    cursor: pointer;
    color: inherit;
    font-family: inherit;
    transition: var(--transition);
}
.user-nav-trigger:hover,
.user-nav-menu.open .user-nav-trigger {
    border-color: rgba(108, 99, 255, 0.5);
    background: rgba(108, 99, 255, 0.15);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.25);
}
.user-nav-name {
    font-size: 0.82rem;
    font-weight: 600;
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-nav-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    inset-inline-end: 0;
    min-width: 260px;
    background: rgba(18, 18, 40, 0.98);
    backdrop-filter: blur(20px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(108, 99, 255, 0.12);
    padding: 8px;
    z-index: 1205;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.98);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    pointer-events: none;
}
.user-nav-menu.open .user-nav-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}
.user-nav-dropdown[hidden] { display: none !important; }
.user-nav-menu.open .user-nav-dropdown[hidden] { display: block !important; }
.user-nav-dropdown-head {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 6px;
}
.user-nav-dropdown-head strong { display: block; font-size: 0.9rem; }
.user-nav-dropdown-head span { font-size: 0.78rem; color: var(--text-muted); }
.user-nav-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 0.88rem;
    transition: var(--transition);
}
.user-nav-dropdown a:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-light); }
.user-nav-dropdown a i { width: 18px; text-align: center; color: var(--primary-light); }
.user-nav-dropdown .nav-dd-danger { color: #fca5a5; }
.user-nav-dropdown .nav-dd-danger i { color: #fca5a5; }
.user-nav-divider { height: 1px; background: var(--border); margin: 6px 4px; }

/* پوسته پنل */
.user-panel-shell {
    padding: 96px 0 48px;
    position: relative;
    z-index: 1;
}
.user-panel-container {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}
.user-panel-sidebar {
    position: sticky;
    top: 96px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    max-height: calc(100dvh - 112px);
    overflow-y: auto;
}
.user-panel-sidebar-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 16px;
    border-bottom: 1px solid var(--border);
}
.user-panel-mini-profile { display: flex; gap: 12px; align-items: center; min-width: 0; }
.user-panel-mini-profile strong { display: block; font-size: 0.9rem; }
.user-panel-mini-profile span { font-size: 0.78rem; color: var(--text-muted); }
.user-panel-close { display: none; }
.user-panel-nav { padding: 10px; }
.user-panel-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    margin-bottom: 4px;
    transition: var(--transition);
}
.user-panel-link:hover { background: rgba(255, 255, 255, 0.06); color: var(--text-light); }
.user-panel-link.active {
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.2), rgba(0, 210, 255, 0.08));
    color: var(--primary-light);
    border-inline-start: 3px solid var(--primary);
    padding-inline-start: 9px;
}
.user-panel-link--danger { color: #fca5a5 !important; }
.user-panel-badge {
    margin-inline-start: auto;
    background: var(--primary);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 100px;
}
.user-panel-main { min-width: 0; }
.user-panel-backdrop { display: none; }

.user-panel-topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}
.user-panel-menu-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    cursor: pointer;
    font-size: 1.1rem;
}

/* کارت‌های داشبورد */
.up-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.up-stat {
    padding: 18px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}
.up-stat-num { font-size: 1.5rem; font-weight: 800; color: var(--text-light); line-height: 1; }
.up-stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }

.up-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 20px;
}
.up-card-head {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.up-card-head h2 { font-size: 1rem; margin: 0; display: flex; align-items: center; gap: 8px; }
.up-card-body { padding: 16px 20px; }
.up-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.up-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 520px; }
.up-table th,
.up-table td { padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); text-align: right; }
.up-table th { font-size: 0.75rem; color: var(--text-muted); background: rgba(0, 0, 0, 0.15); }
.up-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.up-empty .btn { margin-top: 14px; }

.up-quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}
.up-quick-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    text-decoration: none;
    color: var(--text-muted);
    transition: var(--transition);
}
.up-quick-card:hover {
    border-color: rgba(108, 99, 255, 0.4);
    color: var(--text-light);
    transform: translateY(-2px);
}
.up-quick-card i { font-size: 1.25rem; color: var(--primary-light); }
.up-quick-card strong { font-size: 0.88rem; color: var(--text-light); }

.up-form .form-group { margin-bottom: 16px; }
.up-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
}
.up-badge--open { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.up-badge--answered { background: rgba(108, 99, 255, 0.15); color: var(--primary-light); }
.up-badge--waiting { background: rgba(0, 210, 255, 0.12); color: #67e8f9; }
.up-badge--closed { background: rgba(255, 255, 255, 0.08); color: var(--text-muted); }
.up-badge--paid { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.up-badge--pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }

/* تیکت */
.ticket-thread { display: flex; flex-direction: column; gap: 12px; }
.ticket-bubble {
    max-width: 92%;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.7;
}
.ticket-bubble--staff {
    background: rgba(108, 99, 255, 0.12);
    border: 1px solid rgba(108, 99, 255, 0.25);
    align-self: flex-start;
}
.ticket-bubble--user {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    align-self: flex-end;
}
.ticket-bubble time { display: block; font-size: 0.72rem; color: var(--text-muted); margin-top: 8px; }

/* سبد خرید */
.cart-page { padding: 96px 0 56px; }
.cart-layout { max-width: 920px; margin: 0 auto; }
.cart-empty {
    text-align: center;
    padding: 56px 24px;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    background: rgba(255, 255, 255, 0.02);
}
.cart-empty-icon { font-size: 3.5rem; margin-bottom: 16px; opacity: 0.85; }
.cart-items { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.cart-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 16px;
    align-items: center;
    padding: 18px 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
}
.cart-item-title { font-weight: 600; font-size: 0.95rem; }
.cart-item-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.cart-item-price { font-weight: 700; color: var(--primary-light); white-space: nowrap; }
.cart-summary {
    padding: 22px 24px;
    border-radius: var(--radius);
    border: 1px solid rgba(108, 99, 255, 0.3);
    background: linear-gradient(135deg, rgba(108, 99, 255, 0.08), rgba(0, 210, 255, 0.05));
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.cart-summary-total { font-size: 1.35rem; font-weight: 800; }
.cart-summary-total span { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; display: block; margin-bottom: 4px; }

@media (max-width: 1023px) {
    .user-panel-shell { padding-top: 84px; }
    .user-nav-name { display: none; }
    .user-panel-container { grid-template-columns: 1fr; }
    .user-panel-topbar { display: flex; }
    /* سایدبار موبایل — راست در RTL، چپ در LTR (مثل وردپرس) */
    .user-panel-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        inset-inline-start: 0;
        inset-inline-end: auto;
        width: min(300px, 88vw);
        max-height: none;
        height: 100dvh;
        z-index: 1105;
        transform: translateX(100%);
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
        border-radius: 0;
        box-shadow: -12px 0 40px rgba(0, 0, 0, 0.45);
    }
    [dir="ltr"] .user-panel-sidebar {
        inset-inline-start: auto;
        inset-inline-end: 0;
        transform: translateX(100%);
        box-shadow: 12px 0 40px rgba(0, 0, 0, 0.45);
    }
    [dir="ltr"] .user-panel-sidebar.is-open { transform: translateX(0); }
    .user-panel-sidebar.is-open { transform: translateX(0); }
    .user-panel-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1100;
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(2px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.28s, visibility 0.28s;
    }
    .user-panel-backdrop.is-visible { opacity: 1; visibility: visible; }
    .user-panel-close {
        display: inline-flex;
        width: 40px;
        height: 40px;
        align-items: center;
        justify-content: center;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: transparent;
        color: var(--text-light);
        cursor: pointer;
        flex-shrink: 0;
    }
}
@media (max-width: 640px) {
    .cart-item {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    .cart-item-remove { justify-self: start; }
    .cart-summary .btn { width: 100%; justify-content: center; }
    .up-stats { grid-template-columns: 1fr 1fr; }
    .up-form .form-row { grid-template-columns: 1fr !important; }
}
