:root {
    --bg-body: #f4f7fc;
    --bg-surface: #ffffff;
    --bg-sidebar: #ffffff;
    --bg-header: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #94a3b8;
    --text-sidebar: #334155;
    --text-sidebar-hover: #0f172a;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.07);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: 0.25s ease;
    --font: 'Vazirmatn', 'Segoe UI', system-ui, sans-serif;
    --max-width: 1280px;
    --header-height: 68px;
    --sidebar-width: 250px;
    --sidebar-collapsed: 72px;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;

    /* Button design tokens */
    --btn-padding: 0.7rem 1.5rem;
    --btn-min-width: 120px;
    --btn-font-size: 0.95rem;
    --btn-radius: 12px;
    --btn-font-weight: 600;
    --btn-padding-mobile: 0.8rem 1.2rem;
    --btn-font-size-mobile: 1.05rem;
    --btn-min-height-mobile: 48px;
    --btn-sm-padding: 0.35rem 0.9rem;
    --btn-sm-min-width: 80px;
    --btn-sm-font-size: 0.8rem;
    --btn-sm-radius: 8px;
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-surface: #1e293b;
    --bg-sidebar: #1e293b;
    --bg-header: #1e293b;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-sidebar: #94a3b8;
    --text-sidebar-hover: #ffffff;
    --border-color: #334155;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: #1e293b;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    transition: background var(--transition), color var(--transition);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

ul {
    list-style: none;
}

img,
svg {
    display: block;
    max-width: 100%;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 10px;
}

.app-wrapper {
    display: flex;
    flex: 1;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin 0.3s ease;
}

.main-content.with-sidebar {
    margin-right: var(--sidebar-width);
}

.main-content.with-sidebar.expanded {
    margin-right: var(--sidebar-collapsed);
}

.page-content {
    flex: 1;
    padding: 1.75rem;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 999;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    transition: background var(--transition), border var(--transition);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 1.5rem;
    min-width: 120px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--accent);
    color: #ffffff;
    font-family: var(--font);
    text-decoration: none;
}

.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
    color: #ffffff;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-body);
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}

.btn-danger:hover {
    background: #dc2626;
    color: #ffffff;
}

.btn-success {
    background: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background: #16a34a;
    color: #ffffff;
}

.btn-sm {
    padding: 0.45rem 1rem;
    min-width: 90px;
    min-height: 36px;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 600;
}

/* دکمه ساخت (اصلی با +) */
.btn-create {
    background: var(--accent) !important;
    color: #ffffff !important;
}
.btn-create:hover {
    background: var(--accent-hover);
    color: #ffffff;
}
.btn-create::before {
    content: '+';
    font-size: 1.15rem;
    font-weight: 400;
    margin-left: 0.35rem;
    line-height: 1;
}

/* دکمه آموزش (نارنجی) */
.btn-tutorial {
    background: #f59e0b !important;
    color: #ffffff !important;
    border-color: #f59e0b !important;
}
.btn-tutorial:hover {
    background: #d97706;
    color: #ffffff;
    border-color: #d97706;
}

/* نکته: padding و font-size فقط روی .btn پایه اعمال می‌شوند */
/* کلاس‌های رنگی (btn-create, btn-tutorial, ...) فقط رنگ را تغییر می‌دهند */

/* دکمه زیرمجموعه (سبز/بنفش) */
.btn-staff {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border-color: #8b5cf6 !important;
}
.btn-staff:hover {
    background: #7c3aed !important;
    color: #ffffff !important;
    border-color: #7c3aed !important;
}

/* دکمه کوچک هدر */
.btn-header-sm {
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    min-width: auto;
    min-height: 38px;
    gap: 0.4rem;
    width: auto;
}

/* دکمه راهنمای هدر (نارنجی) */
.btn-header-help {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: auto;
    padding: 0.55rem 1.2rem !important;
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    font-family: var(--font);
    min-height: 40px;
    border-radius: var(--radius-sm);
    background: #f59e0b !important;
    color: #ffffff !important;
    border: none !important;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}
.btn-header-help:hover {
    background: #d97706 !important;
    color: #ffffff !important;
}
.btn-header-help svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .btn-header-help {
        width: 100% !important;
        justify-content: center;
        min-height: var(--btn-min-height-mobile);
    }
}

/* دکمه اصلی (آبی - معادل .btn) */
.btn-primary {
    background: var(--accent) !important;
    color: #ffffff !important;
    border-color: var(--accent) !important;
}
.btn-primary:hover {
    background: var(--accent-hover) !important;
    color: #ffffff !important;
    border-color: var(--accent-hover) !important;
}

/* دکمه راهنمای نصب (آبی روشن) */
.btn-info {
    background: #0ea5e9 !important;
    color: #ffffff !important;
    border-color: #0ea5e9 !important;
}
.btn-info:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

/* دکمه افزودن به سبد (سبز با +) */
.btn-cart {
    background: var(--success) !important;
    color: #ffffff !important;
    border-color: var(--success) !important;
    padding: 0.7rem 1.2rem !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    min-height: 42px;
}
.btn-cart:hover {
    background: #16a34a !important;
    color: #ffffff !important;
    border-color: #16a34a !important;
}
.btn-cart::before {
    content: '+';
    font-size: 1.2rem;
    font-weight: 400;
    margin-left: 0.35rem;
    line-height: 1;
}

/* موبایل */
@media (max-width: 768px) {
    .btn-cart {
        padding: 0.55rem 0.85rem !important;
        font-size: 0.95rem !important;
        min-height: 40px;
    }
    .btn-cart::before {
        font-size: 1.15rem;
    }
}

/* دکمه ساخت خودکار (بنفش) */
.btn-auto {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border-color: #8b5cf6 !important;
}
.btn-auto:hover {
    background: #7c3aed;
    color: #ffffff;
    border-color: #7c3aed;
}
.btn-auto:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* دکمه دانلود (سبز) */
.btn-download {
    background: var(--success) !important;
    color: #ffffff !important;
    border-color: var(--success) !important;
}
.btn-download:hover {
    background: #16a34a;
    color: #ffffff;
    border-color: #16a34a;
}

.text-muted {
    color: var(--text-muted);
}

.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.mt-4 {
    margin-top: 1.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 1rem;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 1rem;
}

.gap-4 {
    gap: 1.5rem;
}

.desktop-header-wrapper {
    display: block;
}

.mobile-header-wrapper {
    display: none;
}

.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-surface);
    color: var(--text-secondary);
    z-index: 1000;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease, transform 0.3s ease, background 0.3s ease, color 0.3s ease;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border-left: 1px solid var(--border-color);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar.collapsed .sidebar-label {
    display: none;
}

.sidebar.collapsed .sidebar-nav a {
    justify-content: center;
    padding: 0.65rem 0;
}

.sidebar.collapsed .sidebar-icon svg {
    width: 28px;
    height: 28px;
}

.sidebar-header {
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
}

.sidebar-collapse-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-collapse-btn:hover {
    background: var(--bg-body);
}

.sidebar-collapse-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    transition: transform 0.3s ease;
}

.sidebar.collapsed .sidebar-collapse-btn svg {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    text-decoration: none;
    position: relative;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--bg-body);
    color: var(--text-primary);
}

.sidebar-nav a.logout-link {
    color: var(--danger);
}

.sidebar-nav a.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.sidebar-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.sidebar-label {
    transition: opacity 0.3s ease;
}

.sidebar-mobile {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    height: 100vh;
    background: var(--bg-surface);
    color: var(--text-secondary);
    z-index: 1001;
    padding: 1.25rem 0.75rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, background 0.3s ease, color 0.3s ease;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    border-left: 1px solid var(--border-color);
    transform: translateX(100%);
}

.sidebar-mobile.open {
    transform: translateX(0);
}

.sidebar-mobile-header {
    flex-shrink: 0;
}

.sidebar-mobile-brand {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    padding: 0.5rem 0.75rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.sidebar-mobile-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-mobile-close:hover {
    background: var(--bg-body);
}

.sidebar-mobile-close svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.sidebar-mobile-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    margin: 0;
    list-style: none;
}

.sidebar-mobile-nav li {
    margin-bottom: 4px;
}

.sidebar-mobile-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    text-decoration: none;
}

.sidebar-mobile-nav a:hover,
.sidebar-mobile-nav a.active {
    background: var(--bg-body);
    color: var(--text-primary);
}

.sidebar-mobile-nav a.logout-link {
    color: var(--danger);
}

.sidebar-mobile-nav a.logout-link:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.sidebar-mobile-nav .sidebar-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-mobile-nav .sidebar-icon svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.sidebar-mobile-nav .sidebar-label {
    transition: opacity 0.3s ease;
}

.sidebar-mobile-nav .guest-actions {
    margin-top: 1.5rem;
    padding: 0 0.75rem;
}

.sidebar-mobile-nav .guest-login-btn {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: center;
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-mobile-nav .guest-login-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    color: #ffffff;
}

.desktop-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2.5rem;
    height: var(--header-height);
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition), border var(--transition);
}

.desktop-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    gap: 1.5rem;
}

.desktop-header .header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.desktop-header .header-logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
}

.desktop-header .header-nav ul {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.desktop-header .header-nav ul li a {
    padding: 0.4rem 0.9rem;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
}

.desktop-header .header-nav ul li a:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.desktop-header .header-nav ul li a.header-dashboard-link {
    background: var(--accent);
    color: #ffffff;
}

.desktop-header .header-nav ul li a.header-dashboard-link:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

.desktop-header .header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.desktop-header .header-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    position: relative;
}

.desktop-header .header-theme-toggle:hover {
    background: var(--bg-body);
}

.desktop-header .header-theme-toggle svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.desktop-header .header-theme-toggle .tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.desktop-header .header-theme-toggle:hover .tooltip {
    opacity: 1;
}

.desktop-header .header-cart {
    position: relative;
}

.desktop-header .header-cart-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.2s;
    text-decoration: none;
}

.desktop-header .header-cart-btn:hover {
    background: var(--bg-body);
}

.desktop-header .header-cart-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.desktop-header .cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(25%, -25%);
    border: 2px solid var(--bg-header);
}

.desktop-header .header-cart-btn .tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.desktop-header .header-cart-btn:hover .tooltip {
    opacity: 1;
}

.desktop-header .header-notif {
    position: relative;
}

.desktop-header .header-notif-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 6px 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.2s;
}

.desktop-header .header-notif-btn:hover {
    background: var(--bg-body);
}

.desktop-header .header-notif-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.desktop-header .header-notif-btn .tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.desktop-header .header-notif-btn:hover .tooltip {
    opacity: 1;
}

.desktop-header .notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap;
    transform: translate(30%, -30%);
    border: 2px solid var(--bg-header);
    box-sizing: border-box;
    font-family: var(--font);
    z-index: 10;
}

.desktop-header .notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: auto;
    transform: none;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 320px;
    max-width: 380px;
    padding: 0.5rem 0;
    display: none;
    z-index: 1100;
    max-height: 360px;
    overflow-y: auto;
}

.desktop-header .notif-dropdown.show {
    display: block;
}

.desktop-header .notif-dropdown .notif-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.desktop-header .notif-dropdown .notif-item-link:hover .notif-item {
    background: var(--bg-body);
}

.desktop-header .notif-dropdown .notif-item {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--text-secondary);
    border-right: 3px solid transparent;
    transition: background 0.2s;
}

.desktop-header .notif-dropdown .notif-item:last-child {
    border-bottom: none;
}

.desktop-header .notif-dropdown .notif-item.unread {
    border-right-color: var(--accent);
    background: var(--accent-light);
}

.desktop-header .notif-dropdown .notif-item .notif-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.85rem;
    display: block;
}

.desktop-header .notif-dropdown .notif-item .notif-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: 0.1rem 0;
}

.desktop-header .notif-dropdown .notif-item .notif-time {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.2rem;
}

.desktop-header .notif-dropdown .notif-item .notif-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
}

.desktop-header .notif-dropdown .notif-item .notif-actions button {
    background: none;
    border: none;
    font-size: 0.65rem;
    cursor: pointer;
    font-family: var(--font);
    padding: 0.1rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.desktop-header .notif-dropdown .notif-item .notif-actions .mark-read-btn {
    color: var(--accent);
    background: var(--accent-light);
}

.desktop-header .notif-dropdown .notif-item .notif-actions .mark-read-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

.desktop-header .notif-dropdown .notif-item .notif-actions .delete-btn {
    color: var(--danger);
    background: #fee2e2;
}

.desktop-header .notif-dropdown .notif-item .notif-actions .delete-btn:hover {
    background: var(--danger);
    color: #ffffff;
}

.desktop-header .header-user-wrapper {
    position: relative;
}

.desktop-header .header-user-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 4px 8px;
    border-radius: 30px;
    transition: background 0.2s;
    font-family: var(--font);
    color: var(--text-primary);
    position: relative;
}

.desktop-header .header-user-btn:hover {
    background: var(--bg-body);
}

.desktop-header .header-user-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.desktop-header .header-user-btn .header-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid var(--border-color);
}

.desktop-header .header-user-btn .tooltip {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 10px;
    border-radius: 4px;
    font-size: 0.6rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.desktop-header .header-user-btn:hover .tooltip {
    opacity: 1;
}

.desktop-header .user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 200px;
    padding: 0.5rem 0;
    display: none;
    z-index: 600;
}

.desktop-header .user-dropdown.show {
    display: block;
}

.desktop-header .user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.desktop-header .user-dropdown a:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.desktop-header .user-dropdown a svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
}

.desktop-header .user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.25rem 0;
}

.desktop-header .header-login-btn {
    padding: 0.55rem 1.8rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    background: var(--accent);
    color: #ffffff;
    display: inline-block;
    min-width: 130px;
    text-align: center;
}

.desktop-header .header-login-btn:hover {
    background: var(--accent-hover);
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

.mobile-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 0 0.75rem;
    height: 60px;
    position: sticky;
    top: 0;
    z-index: 900;
    box-shadow: var(--shadow-sm);
    transition: background var(--transition), border var(--transition);
}

.mobile-header .header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    gap: 0.5rem;
}

.mobile-header .header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-header .header-menu-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 8px;
    display: block;
}

.mobile-header .header-menu-toggle:hover {
    background: var(--bg-body);
}

.mobile-header .header-logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
}
.mobile-header .header-logo img {
    height: 32px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    display: block;
}

.mobile-header .header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.mobile-header .header-theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    position: relative;
}

.mobile-header .header-theme-toggle:hover {
    background: var(--bg-body);
}

.mobile-header .header-theme-toggle svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.mobile-header .header-theme-toggle .tooltip {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mobile-header .header-theme-toggle:hover .tooltip {
    opacity: 1;
}

.mobile-header .header-cart {
    position: relative;
}

.mobile-header .header-cart-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.2s;
    text-decoration: none;
}

.mobile-header .header-cart-btn:hover {
    background: var(--bg-body);
}

.mobile-header .header-cart-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.mobile-header .cart-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.5rem;
    font-weight: 700;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translate(25%, -25%);
    border: 2px solid var(--bg-header);
}

.mobile-header .header-cart-btn .tooltip {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mobile-header .header-cart-btn:hover .tooltip {
    opacity: 1;
}

.mobile-header .header-notif {
    position: relative;
}

.mobile-header .header-notif-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: background 0.2s;
}

.mobile-header .header-notif-btn:hover {
    background: var(--bg-body);
}

.mobile-header .header-notif-btn svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.mobile-header .header-notif-btn .tooltip {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mobile-header .header-notif-btn:hover .tooltip {
    opacity: 1;
}

.mobile-header .notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: var(--danger);
    color: #ffffff;
    font-size: 0.6rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
    white-space: nowrap;
    transform: translate(30%, -30%);
    border: 2px solid var(--bg-header);
    box-sizing: border-box;
    font-family: var(--font);
    z-index: 10;
}

.mobile-header .notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: -10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 240px;
    max-width: 260px;
    padding: 0.5rem 0;
    display: none;
    z-index: 600;
    max-height: 300px;
    overflow-y: auto;
}

.mobile-header .notif-dropdown.show {
    display: block;
}

.mobile-header .notif-dropdown .notif-item-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.mobile-header .notif-dropdown .notif-item-link:hover .notif-item {
    background: var(--bg-body);
}

.mobile-header .notif-dropdown .notif-item {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.mobile-header .notif-dropdown .notif-item:last-child {
    border-bottom: none;
}

.mobile-header .notif-dropdown .notif-item .notif-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.8rem;
    display: block;
}

.mobile-header .notif-dropdown .notif-item .notif-msg {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0.1rem 0;
}

.mobile-header .notif-dropdown .notif-item .notif-time {
    font-size: 0.55rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.2rem;
}

.mobile-header .notif-dropdown .notif-item .notif-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.3rem;
    flex-wrap: wrap;
}

.mobile-header .notif-dropdown .notif-item .notif-actions button {
    background: none;
    border: none;
    font-size: 0.6rem;
    cursor: pointer;
    font-family: var(--font);
    padding: 0.1rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.mobile-header .notif-dropdown .notif-item .notif-actions .mark-read-btn {
    color: var(--accent);
    background: var(--accent-light);
}

.mobile-header .notif-dropdown .notif-item .notif-actions .mark-read-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

.mobile-header .notif-dropdown .notif-item .notif-actions .delete-btn {
    color: var(--danger);
    background: #fee2e2;
}

.mobile-header .notif-dropdown .notif-item .notif-actions .delete-btn:hover {
    background: var(--danger);
    color: #ffffff;
}

.mobile-header .header-user-wrapper {
    position: relative;
}

.mobile-header .header-user-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 2px 6px;
    border-radius: 30px;
    transition: background 0.2s;
    font-family: var(--font);
    color: var(--text-primary);
    position: relative;
}

.mobile-header .header-user-btn:hover {
    background: var(--bg-body);
}

.mobile-header .header-user-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.mobile-header .header-user-btn .header-user-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid var(--border-color);
}

.mobile-header .header-user-btn .tooltip {
    position: absolute;
    bottom: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: var(--bg-body);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.mobile-header .header-user-btn:hover .tooltip {
    opacity: 1;
}

.mobile-header .user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: -10px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    min-width: 190px;
    padding: 0.5rem 0;
    display: none;
    z-index: 600;
}

.mobile-header .user-dropdown.show {
    display: block;
}

.mobile-header .user-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.4rem 0.8rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.mobile-header .user-dropdown a:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}

.mobile-header .user-dropdown a svg {
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.mobile-header .user-dropdown hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 0.25rem 0;
}

.mobile-header .header-login-btn {
    padding: 0.25rem 0.8rem;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.7rem;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    background: var(--accent);
    color: #ffffff;
    display: inline-block;
    min-width: 60px;
    text-align: center;
}

.mobile-header .header-login-btn:hover {
    background: var(--accent-hover);
    color: #ffffff;
}

.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 1.75rem;
    margin-top: auto;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    flex-wrap: wrap;
}

.footer-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    width: 100%;
}

.footer-text a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
}

.footer-text a:hover {
    color: var(--accent);
    text-decoration: none;
}

.page-container,
.post-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0;
}

.page-wrapper,
.post-wrapper {
    background: #ffffff;
    border-radius: var(--radius);
    padding: 2.5rem 3rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

@keyframes cartBounce {
    0% { transform: translate(25%, -25%) scale(1); }
    50% { transform: translate(25%, -25%) scale(1.3); }
    100% { transform: translate(25%, -25%) scale(1); }
}

.cart-badge.update {
    animation: cartBounce 0.3s ease;
}


/* ===== مانیتور کوچک — منوی هدر مخفی، دکمه همبرگری ===== */


@media (max-width: 1024px) {
    .sidebar {
        display: none !important;
    }
    .main-content.with-sidebar {
        margin-right: 0;
    }
    .main-content.with-sidebar.expanded {
        margin-right: 0;
    }
    .page-content {
        padding: 1.25rem;
    }
    .desktop-header-wrapper {
        display: none !important;
    }
    .mobile-header-wrapper {
        display: block !important;
    }
    .desktop-header {
        display: none !important;
    }
}

@media (min-width: 1025px) {
    .sidebar-mobile {
        display: none !important;
    }
    .mobile-header {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .page-wrapper,
    .post-wrapper {
        padding: 1.5rem;
    }
}

@media (max-width: 600px) {
    .page-content {
        padding: 1rem;
    }
    .btn {
        padding: 0.4rem 0.9rem;
        font-size: 0.8rem;
    }
    .site-footer {
        padding: 1rem;
    }
    .footer-inner {
        flex-direction: column;
        text-align: center;
        gap: 0.75rem;
    }
    .footer-text {
        font-size: 0.8rem;
    }
    .footer-links {
        gap: 0.75rem;
        justify-content: center;
    }
    .footer-links a {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .page-wrapper,
    .post-wrapper {
        padding: 1rem;
    }
}


/* ===== Sidebar mobile — section title ===== */
.sidebar-mobile .sidebar-mobile-section {
    list-style: none;
    margin-top: 0.75rem;
    margin-bottom: 0.25rem;
    padding: 0 0.75rem;
}
.sidebar-mobile .sidebar-mobile-section:first-child {
    margin-top: 0;
}
.sidebar-mobile .sidebar-section-title {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}
.sidebar-mobile .sidebar-mobile-section + li a {
    padding-top: 0.5rem;
}

/* ============================================================
   استانداردسازی دکمه‌ها در موبایل
   ============================================================ */
@media (max-width: 768px) {
    .btn {
        width: 100%;
        min-width: auto;
        padding: 0.8rem 1.2rem;
        font-size: 1rem;
    }
    .btn-sm {
        width: auto;
        min-width: 90px;
        min-height: 44px;
        padding: 0.55rem 1rem;
        font-size: 0.95rem;
    }
    .form-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .form-actions .btn {
        width: 100%;
    }
    .detail-actions {
        flex-direction: column;
        align-items: stretch;
    }
    .detail-actions .btn {
        width: 100%;
        flex: none;
    }
}

.btn-code {
    background: #8b5cf6 !important;
    color: #ffffff !important;
    border: none !important;
}
.btn-code:hover {
    background: #7c3aed !important;
    color: #ffffff !important;
}

.btn-clear-icon {
    background: transparent;
    color: var(--text-muted);
    border: 1.5px solid var(--border-color);
    padding: 0;
    border-radius: 50%;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    line-height: 1;
    flex-shrink: 0;
}
.btn-clear-icon:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.btn-tutorial,
.btn-code,
.btn-download,
.btn-auto,
.btn-create {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1.2rem;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 40px;
    cursor: pointer;
    text-decoration: none;
    border: none;
    transition: all 0.2s;
}

.btn-add {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: transparent;
    border: 1.5px dashed var(--accent);
    color: var(--accent);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
    margin-top: 0.75rem;
}
.btn-add:hover {
    background: var(--accent);
    color: #fff;
    border-style: solid;
}
.btn-add svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-with-tooltip {
    position: relative;
}
.btn-with-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background: var(--bg-body);
    color: var(--text-primary);
    text-align: center;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    position: absolute;
    z-index: 1;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.3s;
    border: 1px solid var(--border-color);
    font-size: 0.7rem;
    font-weight: 400;
    box-shadow: var(--shadow-md);
}
.btn-with-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}
.btn-with-tooltip .tooltip-text::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--border-color) transparent transparent transparent;
}

.btn-print {
    background: #334155;
    color: #ffffff;
}
.btn-print:hover {
    background: #1a1a2e;
    color: #ffffff;
}
[data-theme="dark"] .btn-print {
    background: #64748b;
    color: #ffffff;
}
[data-theme="dark"] .btn-print:hover {
    background: #94a3b8;
    color: #ffffff;
}

.card .actions,
.assistant-card .actions,
.widget-card .actions,
.bot-card .actions {
    display: flex;
    gap: 0.3rem;
    margin-top: 0.75rem;
    flex-wrap: nowrap;
}

.card .actions .btn-sm,
.assistant-card .actions .btn-sm,
.widget-card .actions .btn-sm,
.bot-card .actions .btn-sm {
    padding: 0.4rem 0.7rem;
    font-size: 0.8rem;
    white-space: nowrap;
    flex: 1;
    text-align: center;
    min-width: 0;
    justify-content: center;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-family: var(--font);
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
}

.card .actions .btn-sm svg,
.assistant-card .actions .btn-sm svg,
.widget-card .actions .btn-sm svg,
.bot-card .actions .btn-sm svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex-shrink: 0;
}

.card .actions .btn-chats,
.assistant-card .actions .btn-chats,
.widget-card .actions .btn-chats,
.bot-card .actions .btn-chats {
    background: #0ea5e9;
    border-color: #0ea5e9;
    color: #fff;
}
.card .actions .btn-chats:hover,
.assistant-card .actions .btn-chats:hover,
.widget-card .actions .btn-chats:hover,
.bot-card .actions .btn-chats:hover {
    background: #0284c7;
    border-color: #0284c7;
    color: #fff;
}

.card .actions .btn-detail,
.assistant-card .actions .btn-detail,
.widget-card .actions .btn-detail,
.bot-card .actions .btn-detail {
    background: #64748b;
    border-color: #64748b;
    color: #fff;
}
.card .actions .btn-detail:hover,
.assistant-card .actions .btn-detail:hover,
.widget-card .actions .btn-detail:hover,
.bot-card .actions .btn-detail:hover {
    background: #475569;
    border-color: #475569;
    color: #fff;
}

.card .actions .btn-edit,
.assistant-card .actions .btn-edit,
.widget-card .actions .btn-edit,
.bot-card .actions .btn-edit {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.card .actions .btn-edit:hover,
.assistant-card .actions .btn-edit:hover,
.widget-card .actions .btn-edit:hover,
.bot-card .actions .btn-edit:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.card .actions .btn-copy,
.assistant-card .actions .btn-copy,
.widget-card .actions .btn-copy,
.bot-card .actions .btn-copy {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
}
.card .actions .btn-copy:hover,
.assistant-card .actions .btn-copy:hover,
.widget-card .actions .btn-copy:hover,
.bot-card .actions .btn-copy:hover {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.card .actions .btn-code,
.assistant-card .actions .btn-code,
.widget-card .actions .btn-code,
.bot-card .actions .btn-code {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
}
.card .actions .btn-code:hover,
.assistant-card .actions .btn-code:hover,
.widget-card .actions .btn-code:hover,
.bot-card .actions .btn-code:hover {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
}

.card .actions .btn-danger,
.assistant-card .actions .btn-danger,
.widget-card .actions .btn-danger,
.bot-card .actions .btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}
.card .actions .btn-danger:hover,
.assistant-card .actions .btn-danger:hover,
.widget-card .actions .btn-danger:hover,
.bot-card .actions .btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
    color: #fff;
}

@media (max-width: 768px) {
    .card .actions,
    .assistant-card .actions,
    .widget-card .actions,
    .bot-card .actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.4rem !important;
    }
    .card .actions .btn-sm,
    .assistant-card .actions .btn-sm,
    .widget-card .actions .btn-sm,
    .bot-card .actions .btn-sm {
        width: 100% !important;
        padding: 0.55rem 0.6rem !important;
        font-size: 0.85rem !important;
    }
}

.btn-clear-icon.is-hidden {
    display: none !important;
}


/* ================================================================
   K.A.3 — Unified Sidebar (desktop + mobile) — 2026-10
   ================================================================ */

/* Links (both standalone and section items) */
.sb-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease, padding 0.15s ease;
    position: relative;
    white-space: nowrap;
    margin-bottom: 2px;
}
.sb-link:hover {
    background: var(--bg-body);
    color: var(--text-primary);
}
.sb-link.active {
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 600;
}
.sb-icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sb-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.sb-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section header */
.sb-section { list-style: none; margin: 0.6rem 0 0; padding: 0; }
.sb-section:first-child { margin-top: 0; }
.sb-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.85rem 0.4rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 8px;
    transition: color 0.15s ease;
}
.sb-section-header:hover { color: var(--text-primary); }
.sb-section-title { flex: 1; text-align: right; }
.sb-chevron {
    width: 14px; height: 14px;
    stroke: currentColor; fill: none;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}
.sb-section.collapsed .sb-chevron { transform: rotate(-90deg); }
.sb-section-items {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 1200px;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.2s ease;
    opacity: 1;
}
.sb-section.collapsed .sb-section-items { max-height: 0; opacity: 0; }

/* Beta badge */
.sb-beta {
    font-size: 0.6rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 8px;
    background: #f59e0b;
    color: #fff;
    flex-shrink: 0;
}

/* Divider */
.sb-divider {
    list-style: none;
    border-top: 1px solid var(--border-color);
    margin: 0.75rem 0.85rem;
    height: 0;
}

/* Collapsed sidebar — tooltip on hover */
.sidebar.collapsed .sb-section-header { display: none; }
.sidebar.collapsed .sb-section-items { max-height: none; opacity: 1; }
.sidebar.collapsed .sb-link { justify-content: center; padding: 0.7rem 0; }
.sidebar.collapsed .sb-label { display: none; }
.sidebar.collapsed .sb-section-items .sb-link { padding: 0.65rem 0; }
.sidebar.collapsed .sb-icon svg { width: 22px; height: 22px; }

/* Tooltip on collapsed */
.sidebar.collapsed .sb-link::after {
    content: attr(title);
    position: absolute;
    right: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: var(--text-primary);
    color: var(--bg-surface);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.sidebar.collapsed .sb-link:hover::after {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

/* ================================================================
   Sidebar — Search, Footer, Better fonts (2026-10)
   ================================================================ */

/* Bigger section titles and links */
.sb-section-header {
    font-size: 0.78rem !important;
    font-weight: 700 !important;
    color: var(--text-secondary) !important;
    padding: 0.7rem 0.85rem 0.5rem !important;
    letter-spacing: 0.3px !important;
}
.sb-section-title { font-size: 0.78rem !important; }
.sb-link { font-size: 0.95rem !important; font-weight: 500 !important; padding: 0.65rem 0.85rem !important; }

/* Search box */
.sb-search {
    position: relative;
    margin: 0.5rem 0.75rem 0.75rem;
}
.sb-search-icon {
    position: absolute;
    top: 50%; right: 0.7rem;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}
.sb-search-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; }
.sb-search input {
    width: 100%;
    padding: 0.5rem 2.2rem 0.5rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    transition: border-color 0.15s;
}
.sb-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.sb-search-results {
    position: absolute;
    top: 100%; right: 0; left: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    margin-top: 4px;
    max-height: 340px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
}
.sb-search-results.show { display: block; }
.sb-search-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}
.sb-search-item:last-child { border-bottom: none; }
.sb-search-item:hover { background: var(--bg-body); }
.sb-search-item small {
    color: var(--text-muted);
    font-size: 0.72rem;
    flex-shrink: 0;
}
.sb-search-empty {
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
}

/* Footer (profile/settings/logout) */
.sb-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.5rem 0;
    margin-top: auto;
    flex-shrink: 0;
}
.sb-footer .sb-link { font-size: 0.9rem !important; }
.sb-footer .logout-link { color: var(--danger); }
.sb-footer .logout-link:hover { background: rgba(239, 68, 68, 0.08); }

/* Sidebar should be flex column with footer at bottom */
.sidebar { display: flex !important; flex-direction: column; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; }
.sidebar-mobile { display: flex !important; flex-direction: column; }
.sidebar-mobile-nav { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* Collapsed: hide search + footer labels */
.sidebar.collapsed .sb-search { display: none; }
.sidebar.collapsed .sb-footer .sb-label { display: none; }
.sidebar.collapsed .sb-footer .sb-link { justify-content: center; padding: 0.7rem 0; }

/* Mobile: same adjustments */
.sidebar-mobile .sb-search { margin-top: 0.75rem; }

/* ================================================================
   Sidebar Polish v2 (2026-10)
   ================================================================ */

/* Widen collapsed sidebar */
:root { --sidebar-collapsed: 82px; }

/* Hidden modern scrollbar */
.sidebar-nav, .sidebar-mobile-nav, .sb-search-results {
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.sidebar-nav::-webkit-scrollbar,
.sidebar-mobile-nav::-webkit-scrollbar,
.sb-search-results::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}
.sidebar-nav:hover,
.sidebar-mobile-nav:hover {
    scrollbar-width: thin;
}
.sidebar-nav:hover::-webkit-scrollbar,
.sidebar-mobile-nav:hover::-webkit-scrollbar {
    width: 4px;
    display: block;
}
.sidebar-nav:hover::-webkit-scrollbar-thumb,
.sidebar-mobile-nav:hover::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

/* Typography hierarchy — bigger section titles, smaller sub-items */
.sb-section-header {
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    color: var(--text-primary) !important;
    letter-spacing: 0.2px !important;
    padding: 0.85rem 0.9rem 0.5rem !important;
    text-transform: none !important;
}
.sb-section-title { font-size: 0.82rem !important; }
.sb-link {
    font-size: 0.88rem !important;
    font-weight: 500 !important;
    padding: 0.55rem 0.9rem !important;
    color: var(--text-secondary) !important;
}
.sb-link:hover { color: var(--text-primary) !important; }
.sb-link.active {
    background: var(--accent-light) !important;
    color: var(--accent) !important;
    font-weight: 600 !important;
}
.sb-icon svg { width: 18px; height: 18px !important; }
.sb-icon { width: 20px !important; height: 20px !important; }

/* Section items indented */
.sb-section-items { padding-right: 0.25rem !important; }
.sb-section-items .sb-link { padding-right: 1.4rem !important; }

/* Collapsed: better spacing + tooltip readable */
.sidebar.collapsed .sb-link { padding: 0.65rem 0 !important; }
.sidebar.collapsed .sb-icon svg { width: 22px !important; height: 22px !important; }
.sidebar.collapsed .sb-icon { width: 24px !important; height: 24px !important; }

/* Search: cleaner */
.sb-search { margin: 0.25rem 0.75rem 0.5rem !important; }
.sb-search input {
    padding: 0.55rem 2.2rem 0.55rem 0.75rem !important;
    font-size: 0.82rem !important;
    background: var(--bg-body) !important;
    border: 1px solid transparent !important;
}
.sb-search input:focus {
    background: var(--bg-surface) !important;
    border-color: var(--accent) !important;
}


/* Mobile: remove divider under اول #page item */
.sidebar-mobile-nav > li:first-child + li.sb-divider { display: none; }

/* Mobile: login item inside list */
.sidebar-mobile .sb-login-item {
    list-style: none;
    padding: 1rem 0.75rem 0.5rem;
    margin-top: 0.5rem;
}
.sidebar-mobile .sb-login-item .guest-login-btn {
    display: block;
    text-align: center;
    padding: 0.75rem;
    background: var(--accent);
    color: #fff;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
}

/* === Guest login button in desktop sidebar === */
.sidebar-nav .sb-login-item {
    list-style: none;
    margin-top: 0.85rem;
    padding: 0.85rem 0.5rem 0;
    border-top: 1px solid var(--border-color);
}
.sidebar-nav .guest-login-btn {
    display: block;
    width: 100%;
    padding: 0.7rem 1rem;
    text-align: center;
    background: var(--accent);
    color: #ffffff;
    border-radius: var(--radius-sm, 10px);
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
    transition: all 0.15s ease;
}
.sidebar-nav .guest-login-btn:hover {
    background: var(--accent-hover, var(--accent));
    color: #ffffff;
    filter: brightness(0.94);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
}

/* === Section as direct link (guest) === */
.sb-section-link {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font);
    font-weight: 700;
    font-size: 0.9rem;
    transition: background 0.13s ease;
}
.sb-section-link:hover {
    background: var(--bg-body);
}
.sb-section-link .sb-icon svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

/* === Collapsed sidebar: guest-login-btn → icon === */
.sidebar.collapsed .sb-login-item {
    padding: 0.85rem 0.4rem 0;
    text-align: center;
}
.sidebar.collapsed .guest-login-btn {
    width: 44px;
    height: 44px;
    padding: 0;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0;
    overflow: hidden;
    position: relative;
}
.sidebar.collapsed .guest-login-btn::before {
    content: '';
    width: 22px;
    height: 22px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/><polyline points='10 17 15 12 10 7'/><line x1='15' y1='12' x2='3' y2='12'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}


/* === Spacing: search → nav === */
.sidebar .sb-search,
.sidebar-mobile .sb-search {
    margin-bottom: 1.25rem;
}

/* Mobile header — small screen fixes */
@media (max-width: 480px) {
    .mobile-header {
        padding: 0 0.5rem;
    }
    .mobile-header .header-inner {
        gap: 0.25rem;
    }
    .mobile-header .header-logo {
        max-width: 100px;
    }
    .mobile-header .header-logo img {
        max-height: 28px;
    }
    .mobile-header .header-actions {
        gap: 0.15rem;
    }
    .mobile-header .header-cart {
        display: none !important;
    }
}
