/* SAS4 Control Panel Styles */
/* Modern dark theme with glassmorphism */

:root {
    /* Colors */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: rgba(30, 30, 50, 0.8);
    --bg-hover: rgba(255, 255, 255, 0.05);

    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-tertiary: #64748b;
    --text-muted: #6b6b80;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    /* Glow Effects */
    --glow-primary: 0 0 20px rgba(99, 102, 241, 0.5);
    --glow-success: 0 0 20px rgba(16, 185, 129, 0.4);
    --glow-danger: 0 0 20px rgba(239, 68, 68, 0.4);
    --glow-card: 0 0 30px rgba(99, 102, 241, 0.1);

    --bg-tertiary: rgba(0, 0, 0, 0.2);
    --surface-glass: rgba(30, 30, 50, 0.6);

    --border-color: rgba(255, 255, 255, 0.1);
    --border-primary: rgba(255, 255, 255, 0.1);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);

    /* Backwards-compatible aliases */
    --surface: var(--bg-card);
    --surface-hover: var(--bg-hover);
    --border-glass: var(--border-color);
    --primary: var(--accent-primary);

    /* Sizing */
    --sidebar-width: 260px;
    --sidebar-mini-width: 64px;
    --topbar-height: 60px;
    --border-radius: 12px;
    --border-radius-sm: 8px;

    /* Layout */
    --transform-sidebar-closed: translateX(-100%);
    --transform-sidebar-open: translateX(0);
}

[dir="rtl"] {
    --transform-sidebar-closed: translateX(100%);
}

/* Light Theme */
[data-theme="light"] {
    /* Colors - Light Mode */
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-hover: rgba(0, 0, 0, 0.04);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;

    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    --success: #059669;
    --warning: #d97706;
    --error: #dc2626;
    --info: #2563eb;

    /* Glow Effects - Light Mode */
    --glow-primary: 0 0 25px rgba(99, 102, 241, 0.35);
    --glow-success: 0 0 20px rgba(5, 150, 105, 0.3);
    --glow-danger: 0 0 20px rgba(220, 38, 38, 0.3);
    --glow-card: 0 4px 20px rgba(99, 102, 241, 0.08);

    --bg-tertiary: rgba(0, 0, 0, 0.04);
    --surface-glass: rgba(255, 255, 255, 0.7);

    --border-color: rgba(0, 0, 0, 0.08);
    --border-primary: rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.12);

    /* Backwards-compatible aliases */
    --surface: var(--bg-card);
    --surface-hover: var(--bg-hover);
    --border-glass: var(--border-color);
    --primary: var(--accent-primary);
}

/* Light mode specific overrides */
[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 2px 0 20px rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar::after {
    background: linear-gradient(180deg,
            transparent 0%,
            rgba(99, 102, 241, 0.3) 20%,
            rgba(139, 92, 246, 0.4) 50%,
            rgba(99, 102, 241, 0.3) 80%,
            transparent 100%);
}

[data-theme="light"] .top-bar {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.98) 0%,
            rgba(248, 250, 252, 0.98) 50%,
            rgba(255, 255, 255, 0.98) 100%);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
    background: rgba(241, 245, 249, 0.8);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .form-input:focus,
[data-theme="light"] .form-select:focus,
[data-theme="light"] .form-textarea:focus {
    background: rgba(255, 255, 255, 1);
    border-color: var(--accent-primary);
}

[data-theme="light"] .modal-content {
    background: #ffffff;
}

[data-theme="light"] .nav-item.active {
    box-shadow: var(--glow-primary), 0 4px 15px rgba(99, 102, 241, 0.25);
}

/* Icon Glow & Lightning Effects */
.icon-glow {
    filter: drop-shadow(0 0 8px currentColor);
}

/* Spinning icon animation (replaces fa-spin) */
.icon-spin {
    animation: iconSpin 1s linear infinite;
}

@keyframes iconSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Brand icon styling (Telegram, WhatsApp, Google Drive inline SVGs) */
.brand-icon {
    display: inline-block;
    vertical-align: middle;
    width: 1em;
    height: 1em;
}

/* =========================================
   THEME COLOR VARIANTS
   ========================================= */

/* Emerald Theme (Green) */
[data-theme-color="emerald"] {
    --bg-primary: #0a1410;
    --bg-secondary: #0f1f18;
    --bg-card: rgba(16, 50, 35, 0.8);
    --bg-hover: rgba(16, 185, 129, 0.1);
    --bg-tertiary: rgba(0, 0, 0, 0.2);
    --surface-glass: rgba(16, 50, 35, 0.6);
    --border-primary: rgba(16, 185, 129, 0.15);

    --accent-primary: #10b981;
    --accent-secondary: #34d399;
    --accent-gradient: linear-gradient(135deg, #10b981 0%, #34d399 100%);

    --glow-card: 0 0 30px rgba(16, 185, 129, 0.2);
    --glow-primary: 0 0 20px rgba(16, 185, 129, 0.5);
    --shadow: 0 8px 32px rgba(16, 185, 129, 0.15);
}

[data-theme-color="emerald"][data-theme="light"] {
    --bg-primary: #ecfdf5;
    --bg-secondary: #d1fae5;
    --bg-card: rgba(255, 255, 255, 0.9);
    --accent-primary: #059669;
    --accent-secondary: #10b981;
    --glow-primary: 0 0 25px rgba(16, 185, 129, 0.35);
}

/* Amber Theme (Orange/Warm) */
[data-theme-color="amber"] {
    --bg-primary: #1a0f0a;
    --bg-secondary: #2a1810;
    --bg-card: rgba(50, 30, 16, 0.8);
    --bg-hover: rgba(245, 158, 11, 0.1);
    --bg-tertiary: rgba(0, 0, 0, 0.2);
    --surface-glass: rgba(50, 30, 16, 0.6);
    --border-primary: rgba(245, 158, 11, 0.15);

    --accent-primary: #f59e0b;
    --accent-secondary: #fbbf24;
    --accent-gradient: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);

    --glow-card: 0 0 30px rgba(245, 158, 11, 0.2);
    --glow-primary: 0 0 20px rgba(245, 158, 11, 0.5);
    --shadow: 0 8px 32px rgba(245, 158, 11, 0.15);
}

[data-theme-color="amber"][data-theme="light"] {
    --bg-primary: #fffbeb;
    --bg-secondary: #fef3c7;
    --bg-card: rgba(255, 255, 255, 0.9);
    --accent-primary: #d97706;
    --accent-secondary: #f59e0b;
    --glow-primary: 0 0 25px rgba(245, 158, 11, 0.35);
}

/* Cyan Theme (Neon Blue) */
[data-theme-color="cyan"] {
    --bg-primary: #0a1318;
    --bg-secondary: #0f1f28;
    --bg-card: rgba(16, 40, 50, 0.8);
    --bg-hover: rgba(6, 182, 212, 0.1);
    --bg-tertiary: rgba(0, 0, 0, 0.2);
    --surface-glass: rgba(16, 40, 50, 0.6);
    --border-primary: rgba(6, 182, 212, 0.15);

    --accent-primary: #06b6d4;
    --accent-secondary: #22d3ee;
    --accent-gradient: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);

    --glow-card: 0 0 30px rgba(6, 182, 212, 0.2);
    --glow-primary: 0 0 20px rgba(6, 182, 212, 0.5);
    --shadow: 0 8px 32px rgba(6, 182, 212, 0.15);
}

[data-theme-color="cyan"][data-theme="light"] {
    --bg-primary: #ecfeff;
    --bg-secondary: #cffafe;
    --bg-card: rgba(255, 255, 255, 0.9);
    --accent-primary: #0891b2;
    --accent-secondary: #06b6d4;
    --glow-primary: 0 0 25px rgba(6, 182, 212, 0.35);
}

/* Ensure backward compatibility aliases update with theme */
[data-theme-color] {
    --primary: var(--accent-primary);
}

.icon-pulse {
    animation: iconPulse 2s ease-in-out infinite;
}

.icon-lightning {
    animation: iconLightning 3s ease-in-out infinite;
}

@keyframes iconPulse {

    0%,
    100% {
        filter: drop-shadow(0 0 6px var(--accent-primary));
    }

    50% {
        filter: drop-shadow(0 0 15px var(--accent-secondary));
    }
}

@keyframes iconLightning {

    0%,
    100% {
        filter: drop-shadow(0 0 5px var(--accent-primary));
        opacity: 1;
    }

    10% {
        filter: drop-shadow(0 0 25px var(--accent-secondary)) drop-shadow(0 0 50px var(--accent-primary));
        opacity: 1;
    }

    12% {
        opacity: 0.85;
    }

    14% {
        opacity: 1;
    }

    50% {
        filter: drop-shadow(0 0 8px var(--accent-primary));
    }
}

/* Stat icon lightning effect */
.stat-icon {
    animation: statIconGlow 2.5s ease-in-out infinite;
}

@keyframes statIconGlow {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(0, 0, 0, 0.2),
            inset 0 0 10px rgba(99, 102, 241, 0.1);
    }

    50% {
        box-shadow: 0 0 25px rgba(99, 102, 241, 0.4),
            inset 0 0 15px rgba(139, 92, 246, 0.2);
    }
}

/* Theme transition for smooth switching */
html {
    transition: background-color 0.3s ease;
}

body,
.sidebar,
.top-bar,
.card,
.stat-card,
.modal-content,
.form-input,
.form-select,
.form-textarea,
.btn,
.badge,
.nav-item {
    transition: background-color 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

/* Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', 'Cairo', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    transition: all 0.3s ease;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(15, 15, 26, 0.98) 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
    box-shadow: 4px 0 30px rgba(0, 0, 0, 0.3);
}

/* Sidebar accent line */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
            transparent 0%,
            var(--accent-primary) 20%,
            var(--accent-secondary) 50%,
            var(--accent-primary) 80%,
            transparent 100%);
    opacity: 0.6;
    animation: sidebarGlow 3s ease-in-out infinite;
}

@keyframes sidebarGlow {

    0%,
    100% {
        opacity: 0.4;
    }

    50% {
        opacity: 0.8;
    }
}

[dir="rtl"] .sidebar {
    box-shadow: -4px 0 30px rgba(0, 0, 0, 0.3);
    right: 0;
    left: auto;
}

[dir="rtl"] .sidebar::after {
    right: auto;
    left: 0;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, transparent 100%);
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.logo-icon {
    font-size: 28px;
    filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.8));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-3px);
    }
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #6366f1 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoShimmer 3s linear infinite;
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.4));
}

@keyframes logoShimmer {
    0% {
        background-position: 0% center;
    }

    100% {
        background-position: 200% center;
    }
}

/* Close/Hamburger button for sidebar (mobile mainly) */
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    display: none;
    transition: all 0.3s ease;
    /* Hidden on desktop by default in header, shown in topbar */
}

.sidebar-toggle:hover {
    color: var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 4px;
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
}

/* Hover shimmer effect */
.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.05) 50%,
            transparent 100%);
    transition: left 0.5s ease;
}

.nav-item:hover::before {
    left: 100%;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-primary);
    transform: translateX(6px);
    border-color: rgba(99, 102, 241, 0.2);
}

[dir="rtl"] .nav-item:hover {
    transform: translateX(-6px);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--glow-primary), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-color: transparent;
    font-weight: 500;
}

.nav-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: white;
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

[dir="rtl"] .nav-item.active::after {
    right: auto;
    left: 0;
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    font-size: 18px;
    min-width: 24px;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.nav-item:hover .nav-icon {
    transform: scale(1.15);
    filter: drop-shadow(0 0 6px var(--accent-primary));
}

.nav-item.active .nav-icon {
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.6));
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* ── Nav Group (collapsible sidebar section) ── */
.nav-group {
    margin-bottom: 2px;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-group-toggle:hover {
    background: rgba(var(--accent-rgb, 99,102,241), 0.08);
    color: var(--text-primary);
}

.nav-group.open > .nav-group-toggle {
    color: var(--accent-color);
}

.nav-group-arrow {
    margin-right: auto;
    display: flex;
    transition: transform 0.25s ease;
}

[dir="ltr"] .nav-group-arrow {
    margin-right: 0;
    margin-left: auto;
}

.nav-group-arrow svg {
    width: 16px;
    height: 16px;
}

.nav-group.open > .nav-group-toggle > .nav-group-arrow {
    transform: rotate(180deg);
}

.nav-group-items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.nav-group.open > .nav-group-items {
    max-height: 1200px;
}

.nav-group-items .nav-item {
    padding-right: 38px;
    font-size: 0.82rem;
}

[dir="ltr"] .nav-group-items .nav-item {
    padding-right: 16px;
    padding-left: 38px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s ease;
}

.status-dot.online {
    background: var(--success);
    box-shadow: 0 0 12px var(--success);
}

.status-text {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin 0.3s ease;
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
}

.top-bar {
    height: var(--topbar-height);
    background: linear-gradient(90deg,
            rgba(26, 26, 46, 0.95) 0%,
            rgba(30, 30, 50, 0.98) 50%,
            rgba(26, 26, 46, 0.95) 100%);
    border-bottom: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2),
        inset 0 -1px 0 rgba(255, 255, 255, 0.05);
}

/* Animated gradient accent line at bottom */
.top-bar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg,
            transparent 0%,
            var(--accent-primary) 20%,
            var(--accent-secondary) 50%,
            var(--accent-primary) 80%,
            transparent 100%);
    opacity: 0.7;
    animation: topbarFlow 4s linear infinite;
}

@keyframes topbarFlow {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

.top-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 50% 0%,
            rgba(99, 102, 241, 0.08) 0%,
            transparent 60%);
    pointer-events: none;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    z-index: 1;
}

.menu-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    transition: all 0.3s ease;
}

/* ── Sidebar Mini Mode (collapsed to 64px icons-only) ── */
.sidebar.collapsed {
    width: var(--sidebar-mini-width);
    overflow: visible;
}

.sidebar.collapsed .sidebar-header {
    padding: 16px 8px;
    justify-content: center;
}

.sidebar.collapsed .logo-text,
.sidebar.collapsed .logo-icon,
.sidebar.collapsed .version-tag,
.sidebar.collapsed .sidebar-toggle {
    display: none;
}

.sidebar.collapsed .sidebar-logo-main {
    height: 28px;
    margin: 0 auto;
}

.sidebar.collapsed .sidebar-nav {
    padding: 8px 6px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
    position: relative;
}

.sidebar.collapsed .nav-text {
    display: none;
}

.sidebar.collapsed .nav-icon {
    min-width: unset;
}

/* Mini mode hover tooltip for nav items */
.sidebar.collapsed .nav-item::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 8px);
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: nowrap;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 200;
}

[dir="rtl"] .sidebar.collapsed .nav-item::after {
    left: auto;
    right: calc(100% + 8px);
}

.sidebar.collapsed .nav-item:hover::after {
    opacity: 1;
}

/* Override the active indicator bar position in mini mode */
.sidebar.collapsed .nav-item.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    left: auto;
    width: 3px;
    height: 60%;
    background: white;
    border-radius: 3px 0 0 3px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    opacity: 1;
    padding: 0;
    border: none;
    font-size: 0;
    pointer-events: auto;
    z-index: auto;
}

[dir="rtl"] .sidebar.collapsed .nav-item.active::after {
    right: auto;
    left: 0;
    border-radius: 0 3px 3px 0;
}

/* Hide nav-group sections in mini mode */
.sidebar.collapsed .nav-group-toggle {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
}

.sidebar.collapsed .nav-group-toggle .nav-text,
.sidebar.collapsed .nav-group-arrow {
    display: none;
}

.sidebar.collapsed .nav-group-items .nav-item {
    padding-right: 0;
    padding-left: 0;
}

[dir="ltr"] .sidebar.collapsed .nav-group-items .nav-item {
    padding-right: 0;
    padding-left: 0;
}

/* Mini mode footer */
.sidebar.collapsed .sidebar-footer {
    padding: 8px 6px;
}

.sidebar.collapsed .sidebar-footer .status-indicator,
.sidebar.collapsed .sidebar-footer .status-text,
.sidebar.collapsed .sidebar-footer .version-tag {
    display: none;
}

.sidebar.collapsed .sidebar-footer .nav-item {
    justify-content: center;
    padding: 10px 0;
}

/* Mini mode: reduce hover translateX */
.sidebar.collapsed .nav-item:hover {
    transform: none;
}

/* Main content adjusts to mini sidebar */
.sidebar.collapsed~.main-content {
    margin-left: var(--sidebar-mini-width) !important;
}

[dir="rtl"] .sidebar.collapsed~.main-content {
    margin-left: 0 !important;
    margin-right: var(--sidebar-mini-width) !important;
}

.menu-toggle-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
}

.menu-toggle-btn:hover {
    color: var(--accent-primary);
    text-shadow: 0 0 15px var(--accent-primary);
}

.page-title h1 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar-actions {
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

/* Enhanced icon buttons in toolbar */
.top-bar-actions .btn-icon {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.top-bar-actions .btn-icon:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3),
        inset 0 0 15px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px) rotate(0deg);
    color: var(--accent-primary);
}

.top-bar-actions .btn-icon:active {
    transform: translateY(0) scale(0.95);
}

.content-wrapper {
    padding: 24px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--glow-card);
    border-color: rgba(99, 102, 241, 0.3);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border-color);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--glow-card);
    border-color: rgba(99, 102, 241, 0.3);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--accent-primary);
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s;
}

.stat-card:hover .stat-icon {
    background: var(--accent-gradient);
    color: white;
    box-shadow: var(--glow-primary);
}

.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

[dir="rtl"] .data-table th,
[dir="rtl"] .data-table td {
    text-align: right;
}

.data-table th {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.data-table tr:hover {
    background: var(--bg-hover);
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-secondary {
    background: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.badge-user_login {
    background: rgba(99, 102, 241, 0.2);
    color: var(--accent-primary);
}

.badge-user_logout {
    background: rgba(139, 92, 246, 0.2);
    color: var(--accent-secondary);
}

.badge-user_register {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.badge-user_renewal {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

.badge-quota_warning {
    background: rgba(245, 158, 11, 0.2);
    color: var(--warning);
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.3);
}

.badge-quota_exceeded {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

/* Buttons - Glowing Effects */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.btn-primary:hover {
    box-shadow: var(--glow-primary);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
}

.btn-icon {
    padding: 8px;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
}

/* Telegram bot buttons in top bar */
.topbar-bot-btn {
    padding: 8px !important;
    overflow: visible !important;
    color: #29B6F6 !important;
    background: rgba(41, 182, 246, 0.1) !important;
    border: 1px solid rgba(41, 182, 246, 0.3) !important;
}
.topbar-bot-btn:hover {
    background: rgba(41, 182, 246, 0.25) !important;
    box-shadow: 0 0 12px rgba(41, 182, 246, 0.4) !important;
    transform: scale(1.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--error);
    color: white;
    box-shadow: var(--glow-danger);
}

/* Logout button specifically */
.logout-btn:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    box-shadow: var(--glow-danger);
    color: var(--error) !important;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    background: rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Queue Stats */
.queue-stats {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    justify-content: space-around;
}

.queue-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--border-radius);
}

.queue-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.queue-value {
    font-size: 32px;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.queue-value.pending {
    color: var(--warning);
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
}

.queue-value.processing {
    color: var(--info);
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.queue-value.sent {
    color: var(--success);
    text-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.queue-value.failed {
    color: var(--error);
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--bg-hover);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    align-items: center;
    justify-content: center;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.open {
    display: flex;
    opacity: 1;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.open .modal-content {
    transform: scale(1);
}

.modal-content.modal-lg {
    max-width: 700px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.modal-body pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    overflow-x: auto;
    font-size: 13px;
    border: 1px solid var(--border-color);
    font-family: 'Fira Code', monospace;
}

/* Toggle Switch - Global */
.switch,
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    min-width: 44px;
    height: 24px;
    cursor: pointer;
    flex-shrink: 0;
}

.switch input,
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.slider,
.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 34px;
    transition: all 0.3s ease;
}

.slider::before,
.toggle-slider::before {
    content: '';
    display: block;
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #ffffff;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked+.slider,
input:checked+.toggle-slider {
    background: linear-gradient(135deg, #10b981, #34d399);
    border-color: #10b981;
    box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

input:checked+.slider::before,
input:checked+.toggle-slider::before {
    transform: translateX(20px);
}

/* Template Items */
.template-item {
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.2s;
}

.template-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.2);
}

.template-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.template-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.template-preview {
    display: grid;
    gap: 12px;
}

.preview-section label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: block;
}

.preview-section code {
    display: block;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Theme Toggle Icons */
.theme-icon {
    display: none;
}

/* In dark mode, show sun icon */
[data-theme="dark"] .theme-icon-light {
    display: block;
}

/* In light mode, show moon icon  */
[data-theme="light"] .theme-icon-dark {
    display: block;
}

/* In cyberpunk mode, show zap icon */
[data-theme="cyberpunk"] .theme-icon-cyberpunk {
    display: block;
}

#theme-toggle {
    position: relative;
}

#theme-toggle svg,
#theme-toggle i {
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#theme-toggle:hover svg,
#theme-toggle:hover i {
    transform: rotate(15deg) scale(1.1);
    filter: drop-shadow(0 0 8px var(--accent-primary));
}

/* Theme Switcher Dropdown */
.theme-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: var(--shadow-lg);
    display: none;
    z-index: 1000;
    margin-top: 10px;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.theme-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease-out;
}

[data-theme="light"] .theme-dropdown {
    background: rgba(255, 255, 255, 0.95);
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.theme-grid[data-ch="1"] .theme-color-btn[data-color="indigo"]{order:3}
.theme-grid[data-ch="1"] .theme-color-btn[data-color="emerald"]{order:4}
.theme-grid[data-ch="1"] .theme-color-btn[data-color="amber"]{order:1}
.theme-grid[data-ch="1"] .theme-color-btn[data-color="cyan"]{order:2}

.theme-color-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: var(--bg-hover);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.theme-color-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.theme-color-btn.active {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

[data-theme="light"] .theme-color-btn.active {
    background: rgba(0, 0, 0, 0.05);
}

.color-preview {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

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

/* Responsive Logic */
/* ── Tablet: sidebar starts in mini mode ── */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        width: var(--sidebar-mini-width);
        overflow: visible;
    }

    .sidebar .sidebar-header {
        padding: 16px 8px;
        justify-content: center;
    }

    .sidebar .logo-text,
    .sidebar .logo-icon,
    .sidebar .version-tag,
    .sidebar .sidebar-toggle {
        display: none;
    }

    .sidebar .sidebar-logo-main {
        height: 28px;
        margin: 0 auto;
    }

    .sidebar .sidebar-nav {
        padding: 8px 6px;
    }

    .sidebar .nav-item {
        justify-content: center;
        padding: 12px 0;
        gap: 0;
    }

    .sidebar .nav-text {
        display: none;
    }

    .sidebar .nav-item:hover {
        transform: none;
    }

    /* Tooltip on hover */
    .sidebar .nav-item::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 8px);
        top: 50%;
        transform: translateY(-50%);
        background: var(--bg-secondary);
        color: var(--text-primary);
        padding: 6px 12px;
        border-radius: 6px;
        font-size: 0.8rem;
        white-space: nowrap;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
        border: 1px solid var(--border-color);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 200;
    }

    [dir="rtl"] .sidebar .nav-item::after {
        left: auto;
        right: calc(100% + 8px);
    }

    .sidebar .nav-item:hover::after {
        opacity: 1;
    }

    .sidebar .nav-item.active::after {
        content: '';
        width: 3px;
        height: 60%;
        background: white;
        opacity: 1;
        padding: 0;
        border: none;
        font-size: 0;
        pointer-events: auto;
        z-index: auto;
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%);
        left: auto;
        border-radius: 3px 0 0 3px;
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }

    .sidebar .nav-group-toggle {
        justify-content: center;
        padding: 12px 0;
        gap: 0;
    }

    .sidebar .nav-group-toggle .nav-text,
    .sidebar .nav-group-arrow {
        display: none;
    }

    .sidebar .nav-group-items .nav-item {
        padding-right: 0;
        padding-left: 0;
    }

    .sidebar .sidebar-footer {
        padding: 8px 6px;
    }

    .sidebar .sidebar-footer .status-indicator,
    .sidebar .sidebar-footer .status-text {
        display: none;
    }

    .sidebar .sidebar-footer .nav-item {
        justify-content: center;
        padding: 10px 0;
    }

    .main-content {
        margin-left: var(--sidebar-mini-width) !important;
    }

    [dir="rtl"] .main-content {
        margin-left: 0 !important;
        margin-right: var(--sidebar-mini-width) !important;
    }

    /* On tablet, expanded sidebar goes full width overlay */
    .sidebar.expanded {
        width: var(--sidebar-width);
        z-index: 110;
    }

    .sidebar.expanded .logo-text,
    .sidebar.expanded .logo-icon,
    .sidebar.expanded .sidebar-toggle,
    .sidebar.expanded .nav-text,
    .sidebar.expanded .nav-group-arrow,
    .sidebar.expanded .sidebar-footer .status-indicator,
    .sidebar.expanded .sidebar-footer .status-text {
        display: flex;
    }

    .sidebar.expanded .sidebar-header {
        padding: 24px 20px;
        justify-content: space-between;
    }

    .sidebar.expanded .sidebar-nav {
        padding: 16px 12px;
    }

    .sidebar.expanded .nav-item {
        justify-content: flex-start;
        padding: 12px 16px;
        gap: 12px;
    }

    .sidebar.expanded .nav-group-toggle {
        justify-content: flex-start;
        padding: 12px 16px;
        gap: 12px;
    }

    .sidebar.expanded .sidebar-footer {
        padding: 16px 20px;
    }

    .sidebar.expanded .sidebar-footer .nav-item {
        justify-content: flex-start;
        padding: 12px 16px;
    }
}

/* ── Mobile: sidebar hidden, slides in as overlay ── */
@media (max-width: 768px) {
    .sidebar {
        transform: var(--transform-sidebar-closed);
        width: 280px;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }

    .sidebar.open {
        transform: var(--transform-sidebar-open);
    }

    /* Overlay backdrop */
    .sidebar.open::before {
        content: '';
        position: fixed;
        top: 0;
        right: -100vw;
        bottom: 0;
        left: 100%;
        width: 200vw;
        height: 100vh;
        height: 100dvh;
        background: rgba(0, 0, 0, 0.5);
        -webkit-backdrop-filter: blur(4px);
        backdrop-filter: blur(4px);
        z-index: -1;
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
        overflow-x: hidden;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .filter-row {
        flex-direction: column;
    }

    .filter-group {
        width: 100%;
    }

    .top-bar {
        padding: 0 16px;
    }

    .top-bar-actions .btn-icon span {
        display: none;
    }

    .content-wrapper {
        overflow-x: hidden;
        max-width: 100vw;
    }
}

/* ── Controller Layout Utility Classes ────────────────────── */
/* (مستخدمة في controller/base.html بدلاً من inline styles)   */

.sidebar-logo-img {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.nav-logout-btn {
    font-size: 1.3rem;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
}

.nav-logout-label {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-muted);
    display: block;
}

/* ── base.html Utility Classes ─────────────────────────────── */

/* الشعار الرئيسي في الشريط الجانبي */
.sidebar-logo-main {
    height: 36px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.3));
}

/* زر تسجيل الخروج الرئيسي */
.nav-logout-main {
    margin-top: 10px;
    color: #ef4444;
}

.nav-logout-main:hover {
    color: #ef4444 !important;
}

/* ألوان مسبقة للـ color-preview swatches */
.color-preview-indigo {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.color-preview-emerald {
    background: linear-gradient(135deg, #10b981, #34d399);
}

.color-preview-amber {
    background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

.color-preview-cyan {
    background: linear-gradient(135deg, #06b6d4, #22d3ee);
}

/* SAS modal helpers */
.modal-body-center {
    text-align: center;
}

.modal-desc {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.modal-error-msg {
    color: var(--error);
    margin-bottom: 15px;
    display: none;
}

.modal-btn-full {
    width: 100%;
}

.modal-btn-mb {
    margin-bottom: 10px;
}

/* app-modal-input hidden by default */
.app-modal-input-hidden {
    display: none;
}

/* dashboard.html + login.html utility classes */
.icon-sm svg,
.icon-sm {
    width: 14px;
    height: 14px;
}

.gotik-value {
    color: #f59e0b;
}

.quota-settings-link {
    text-decoration: none;
}

.info-card-clickable {
    cursor: pointer;
}

/* login page logo */
.login-logo-img {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 50%;
    filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.4));
}

/* ── Color Icon Utilities (ci-*) ──────────────────────────── */
/* Used in settings.html and other toggle sections */
.ci-indigo {
    color: #6366f1;
}

.ci-amber {
    color: #f59e0b;
}

.ci-violet {
    color: #8b5cf6;
}

.ci-emerald {
    color: #10b981;
}

.ci-blue {
    color: #3b82f6;
}

.ci-pink {
    color: #ec4899;
}

.ci-purple {
    color: #a855f7;
}

.ci-red {
    color: #ef4444;
}

.ci-cyan {
    color: #06b6d4;
}

.ci-green {
    color: #22c55e;
}

.ci-slate {
    color: #64748b;
}

/* ── Settings Card Icon Gradient Utilities (sci-*) ─────────── */
.sci-indigo {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.sci-violet {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
}

.sci-blue {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.sci-cyan {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.sci-indigo-dark {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.sci-emerald {
    background: linear-gradient(135deg, #10b981, #059669);
}

.sci-pink {
    background: linear-gradient(135deg, #ec4899, #d946ef);
}

.sci-amber {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.sci-teal {
    background: linear-gradient(135deg, #14b8a6, #0891b2);
}

.sci-red {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

/* ── settings.html Helper Classes ─────────────────────────── */
.th-center {
    text-align: center;
}

.btn-inline-flex {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.gotik-info-box {
    margin-top: 20px;
    padding: 14px 18px;
    background: rgba(99, 102, 241, 0.08);
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.15);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.gotik-info-box a {
    color: #8b5cf6;
    font-weight: 600;
    text-decoration: underline;
    margin-inline-start: 6px;
}

.form-group-flex {
    flex: 1;
}

.mt-12 {
    margin-top: 12px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-20 {
    margin-top: 20px;
}

.mt-8 {
    margin-top: 8px;
}

.mb-12 {
    margin-bottom: 12px;
}

.fs-09rem {
    font-size: 0.9rem;
}

.admin-add-form-mt {
    margin-top: 20px;
}

.result-div {
    margin-top: 12px;
    font-size: 0.9rem;
}

.settings-section-hidden {
    display: none;
    margin-top: 20px;
}

.provider-options-row {
    margin-top: 20px;
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.provider-flex {
    flex: 1;
    min-width: 200px;
}

.provider-icon-lg {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.small-secondary {
    color: var(--text-secondary);
}

.small-block {
    display: block;
    color: var(--text-secondary);
    margin-top: 4px;
}

.small-block-2 {
    display: block;
    color: var(--text-secondary);
    margin-top: 2px;
}

.reset-section {
    padding: 24px;
    text-align: center;
}

.btn-auto {
    width: auto;
}

.reset-hint {
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.section-full-col {
    grid-column: 1 / -1;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin-top: 4px;
    padding-top: 16px;
}

.toggle-info-mb {
    margin-bottom: 12px;
}

.notify-methods-grid {
    margin-top: 20px;
}

.notify-methods-title {
    grid-column: 1 / -1;
    margin: 0 0 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.select-mb {
    margin-bottom: 12px;
}

/* ── sidebar status-indicator cursor ─────────── */
.status-clickable {
    cursor: pointer;
}

/* ── theme wrapper inline-block ─────────────── */
.dropdown-wrapper {
    position: relative;
    display: inline-block;
}
/* ── d-none / cursor-ptr utilities ─── */
.d-none { display: none; }
.cursor-ptr { cursor: pointer; }

/* ── Global select/option fix for dark theme ─── */
/* option elements don't inherit dark theme in most browsers */
select option {
    background: var(--bg-secondary, #1a1a2e);
    color: var(--text-primary, #e2e8f0);
}

select optgroup {
    background: var(--bg-secondary, #1a1a2e);
    color: var(--text-primary, #e2e8f0);
}

[data-theme="light"] select option,
[data-theme="light"] select optgroup {
    background: #ffffff;
    color: #0f172a;
}
