/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

:root {
    /* Wink: deep navy with an amber accent (same as the other Wink sites) */
    --primary: #F2B84B;
    --primary-dark: #D99A2B;
    --primary-light: #F7CF7E;
    --primary-rgb: 242, 184, 75;
    --on-primary: #1A1405;
    --accent: #8E9FBD;
    --success: #4FD1A1;
    --success-rgb: 79, 209, 161;
    --danger: #F0716A;
    --warning: #F59E0B;
    --background: #0C1424;
    --surface-rgb: 18, 29, 51;
    --surface: rgba(18, 29, 51, 0.72);
    --surface-strong: rgba(18, 29, 51, 0.86);
    --surface-stronger: rgba(23, 36, 63, 0.96);
    --border: rgba(52, 72, 110, 0.55);
    --border-strong: rgba(242, 184, 75, 0.45);
    --text-primary: #EAF0FA;
    --text-secondary: #A7B4CC;
    --text-muted: #7A8BA9;
    --text-disabled: #4A5A78;
    --shadow-soft: 0 12px 36px -18px rgba(0, 0, 0, 0.8);
    --shadow-hover: 0 10px 28px -14px rgba(242, 184, 75, 0.35);
    --font-body: 'IBM Plex Sans Arabic', 'Inter', system-ui, sans-serif;
    --font-head: 'Noto Kufi Arabic', 'IBM Plex Sans Arabic', 'Inter', sans-serif;
    /* Typography */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --spacing-xs: 0.5rem;
    --spacing-sm: 0.75rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="blue"] {
    --primary: #00d2ff;
    --primary-dark: #007bb5;
    --primary-light: #66e0ff;
    --success: #00d2ff;
    --background: #020813;
    --surface: rgba(10, 30, 50, 0.4);
    --surface-strong: rgba(10, 30, 50, 0.6);
    --surface-stronger: rgba(10, 30, 50, 0.8);
    --border: rgba(0, 210, 255, 0.2);
    --border-strong: rgba(0, 210, 255, 0.4);
    --shadow-hover: 0 8px 30px rgba(0, 210, 255, 0.2);
    --primary-rgb: 0, 210, 255;
    --surface-rgb: 10, 30, 50;
}

[data-theme="red"] {
    --primary: #ff3b30;
    --primary-dark: #cc2922;
    --primary-light: #ff6b62;
    --success: #ff3b30;
    --background: #120303;
    --surface: rgba(45, 10, 10, 0.4);
    --surface-strong: rgba(45, 10, 10, 0.6);
    --surface-stronger: rgba(45, 10, 10, 0.8);
    --border: rgba(255, 59, 48, 0.2);
    --border-strong: rgba(255, 59, 48, 0.4);
    --shadow-hover: 0 8px 30px rgba(255, 59, 48, 0.2);
    --primary-rgb: 255, 59, 48;
    --surface-rgb: 45, 10, 10;
}

[data-theme="purple"] {
    --primary: #bf5af2;
    --primary-dark: #8e3ab5;
    --primary-light: #d18af5;
    --success: #bf5af2;
    --background: #090312;
    --surface: rgba(30, 10, 45, 0.4);
    --surface-strong: rgba(30, 10, 45, 0.6);
    --surface-stronger: rgba(30, 10, 45, 0.8);
    --border: rgba(191, 90, 242, 0.2);
    --border-strong: rgba(191, 90, 242, 0.4);
    --shadow-hover: 0 8px 30px rgba(191, 90, 242, 0.2);
    --primary-rgb: 191, 90, 242;
    --surface-rgb: 30, 10, 45;
}

[data-theme="gold"] {
    --primary: #ffd60a;
    --primary-dark: #ccab08;
    --primary-light: #ffe14d;
    --success: #ffd60a;
    --background: #121002;
    --surface: rgba(45, 40, 10, 0.4);
    --surface-strong: rgba(45, 40, 10, 0.6);
    --surface-stronger: rgba(45, 40, 10, 0.8);
    --border: rgba(255, 214, 10, 0.2);
    --border-strong: rgba(255, 214, 10, 0.4);
    --shadow-hover: 0 8px 30px rgba(255, 214, 10, 0.2);
    --primary-rgb: 255, 214, 10;
    --surface-rgb: 45, 40, 10;
}

[data-theme="orange"] {
    --primary: #ff9f0a;
    --primary-dark: #cc7f08;
    --primary-light: #ffb64d;
    --success: #ff9f0a;
    --background: #140d02;
    --surface: rgba(50, 30, 10, 0.4);
    --surface-strong: rgba(50, 30, 10, 0.6);
    --surface-stronger: rgba(50, 30, 10, 0.8);
    --border: rgba(255, 159, 10, 0.2);
    --border-strong: rgba(255, 159, 10, 0.4);
    --shadow-hover: 0 8px 30px rgba(255, 159, 10, 0.2);
    --primary-rgb: 255, 159, 10;
    --surface-rgb: 50, 30, 10;
}

[data-theme="pink"] {
    --primary: #ff2d55;
    --primary-dark: #cc2444;
    --primary-light: #ff6682;
    --success: #ff2d55;
    --background: #140409;
    --surface: rgba(50, 10, 20, 0.4);
    --surface-strong: rgba(50, 10, 20, 0.6);
    --surface-stronger: rgba(50, 10, 20, 0.8);
    --border: rgba(255, 45, 85, 0.2);
    --border-strong: rgba(255, 45, 85, 0.4);
    --shadow-hover: 0 8px 30px rgba(255, 45, 85, 0.2);
    --primary-rgb: 255, 45, 85;
    --surface-rgb: 50, 10, 20;
}

[data-theme="teal"] {
    --primary: #64d2ff;
    --primary-dark: #4fa8cc;
    --primary-light: #8edfff;
    --success: #64d2ff;
    --background: #061114;
    --surface: rgba(20, 40, 50, 0.4);
    --surface-strong: rgba(20, 40, 50, 0.6);
    --surface-stronger: rgba(20, 40, 50, 0.8);
    --border: rgba(100, 210, 255, 0.2);
    --border-strong: rgba(100, 210, 255, 0.4);
    --shadow-hover: 0 8px 30px rgba(100, 210, 255, 0.2);
    --primary-rgb: 100, 210, 255;
    --surface-rgb: 20, 40, 50;
}

[data-theme="dracula"] {
    --primary: #ff79c6;
    --primary-dark: #bd93f9;
    --primary-light: #ff92d0;
    --success: #50fa7b;
    --danger: #ff5555;
    --warning: #f1fa8c;
    --background: #282a36;
    --surface: rgba(68, 71, 90, 0.4);
    --surface-strong: rgba(68, 71, 90, 0.6);
    --surface-stronger: rgba(68, 71, 90, 0.8);
    --border: rgba(98, 114, 164, 0.5);
    --border-strong: rgba(98, 114, 164, 0.8);
    --text-primary: #f8f8f2;
    --text-secondary: #bfbfbf;
    --shadow-hover: 0 8px 30px rgba(255, 121, 198, 0.2);
    --primary-rgb: 255, 121, 198;
    --surface-rgb: 68, 71, 90;
}

[data-theme="black-and-white"] {
    --primary: #ffffff;
    --primary-dark: #cccccc;
    --primary-light: #ffffff;
    --success: #ffffff;
    --danger: #ffffff;
    --warning: #cccccc;
    --background: #000000;
    --surface: rgba(25, 25, 25, 0.8);
    --surface-strong: rgba(40, 40, 40, 0.9);
    --surface-stronger: rgba(60, 60, 60, 1);
    --border: rgba(255, 255, 255, 0.3);
    --border-strong: rgba(255, 255, 255, 0.6);
    --text-primary: #ffffff;
    --text-secondary: #cccccc;
    --text-muted: #999999;
    --shadow-hover: 0 8px 30px rgba(255, 255, 255, 0.3);
    --primary-rgb: 255, 255, 255;
    --surface-rgb: 25, 25, 25;
}

body {
    background: linear-gradient(135deg, var(--background) 0%, #0d1a10 50%, var(--background) 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Focus styles */
*:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

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

::-webkit-scrollbar-track {
    background: var(--surface);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 5px;
    transition: all var(--transition-base);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.5);
}

::-webkit-scrollbar-corner {
    background: var(--surface);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--primary) var(--surface);
}

/* Disabled form elements styling */
select:disabled,
input:disabled,
button:disabled,
textarea:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--surface-strong);
    border-color: var(--border);
    color: var(--text-disabled);
}

/* Custom Perk Modal Enhancements */
.custom-perk-modal button:hover {
    transform: translateY(-2px);
}

.custom-perk-modal #cancelBtn:hover {
    background: var(--surface);
    border-color: var(--border-strong);
}

.custom-perk-modal #savePerkBtn:hover {
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.5);
}

.custom-perk-modal #toggleEmojiPicker:hover {
    transform: scale(1.08);
    border-color: var(--primary);
}

.custom-perk-modal input:focus,
.custom-perk-modal textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.custom-perk-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.custom-perk-item:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* Default Perk Inputs */
.default-perk-input {
    width: 100%;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 2px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s ease;
}

.default-perk-input::placeholder {
    color: var(--text-muted);
}

.default-perk-input:hover {
    border-color: var(--border-strong);
}

.default-perk-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--spacing-xl);
}

.login-container {
    width: 100%;
    max-width: 480px;
    animation: containerFloat 6s ease-in-out infinite;
}

@keyframes containerFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.login-box {
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: var(--spacing-2xl) var(--spacing-xl);
    text-align: center;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animated background accents */
.login-box::before,
.login-box::after {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    opacity: 0.1;
    filter: blur(60px);
    animation: pulseGlow 4s ease-in-out infinite;
}

.login-box::before {
    background: var(--primary);
    top: -80px;
    left: -60px;
}

.login-box::after {
    background: var(--accent);
    bottom: -100px;
    right: -80px;
    animation-delay: -2s;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.1; }
    50% { transform: scale(1.15); opacity: 0.2; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-box h1 {
    color: var(--text-primary);
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

.login-box p {
    color: var(--text-secondary);
    font-size: 1.15rem;
    margin-bottom: var(--spacing-2xl);
    font-weight: 400;
}

.discord-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-primary);
    padding: var(--spacing-md) var(--spacing-xl);
    border-radius: var(--radius-lg);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.35);
    position: relative;
    overflow: hidden;
}

.discord-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.discord-btn:hover::before {
    transform: translateX(100%);
}

.discord-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 12px 40px rgba(var(--primary-rgb), 0.5);
}

.discord-btn:active {
    transform: translateY(-1px) scale(0.98);
    box-shadow: 0 4px 20px rgba(var(--primary-rgb), 0.35);
}

.discord-icon {
    width: 26px;
    height: 26px;
}

.lang-switcher {
    margin-top: var(--spacing-xl);
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
}

.lang-switcher-sidebar {
    display: flex;
    gap: var(--spacing-xs);
    margin-bottom: var(--spacing-md);
}

.lang-btn {
    padding: var(--spacing-sm) var(--spacing-lg);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
    font-size: 0.95rem;
}

.lang-btn:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.lang-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

/* Dashboard Page */
.dashboard-page {
    margin: 0;
    padding: 0;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 300px;
    background: var(--surface);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-soft);
}

.sidebar-header h2 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: var(--spacing-xl);
    background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.025em;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: all var(--transition-base);
    text-align: left;
    font-weight: 500;
    position: relative;
}

.nav-item:hover {
    background: var(--surface-strong);
    color: var(--text-primary);
    transform: translateX(4px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-primary);
    border-color: var(--primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.nav-icon {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    flex-shrink: 0;
}

/* Sidebar section category labels */
.nav-category {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 1.6px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 14px 4px 4px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
    user-select: none;
}

.nav-category::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    opacity: 0.6;
}

.nav-category.super-admin-cat {
    color: #f59e0b;
}

.nav-category.super-admin-cat::after {
    background: linear-gradient(90deg, rgba(245,158,11,0.3), transparent);
}

.sidebar-footer {
    padding-top: var(--spacing-lg);
    border-top: 1px solid var(--border);
}

.user-info {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    padding: var(--spacing-sm);
    background: var(--surface);
    border-radius: var(--radius-md);
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-lg);
    object-fit: cover;
    border: 2px solid var(--primary);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.3);
    transition: transform var(--transition-base);
}

.user-avatar:hover {
    transform: scale(1.05);
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1rem;
}

.user-role {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.logout-btn {
    display: block;
    width: 100%;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, var(--danger), #d32f2f);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    font-weight: 600;
    transition: all var(--transition-base);
    box-shadow: 0 4px 15px rgba(255, 82, 82, 0.3);
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 82, 82, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    animation: mainContentFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

@keyframes mainContentFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ─── Top Bar ──────────────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    height: 64px;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(0,0,0,0.25);
    position: sticky;
    top: 0;
    z-index: 100;
    flex-shrink: 0;
    gap: 16px;
}

/* left side */
.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.topbar-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 6px var(--primary), 0 0 12px rgba(var(--primary-rgb),0.4);
    animation: statusPulse 2.5s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.85); }
}

.topbar-greeting {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* right side */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

/* vertical divider */
.topbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-strong);
    opacity: 0.5;
    margin: 0 6px;
    flex-shrink: 0;
}

/* lang switcher inside topbar */
.topbar-lang-switcher {
    display: flex;
    gap: 4px;
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 3px;
}

.topbar-lang-switcher .lang-btn {
    padding: 4px 12px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: calc(var(--radius-md) - 2px);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.topbar-lang-switcher .lang-btn:hover {
    color: var(--text-primary);
    background: var(--surface-strong);
}

.topbar-lang-switcher .lang-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--primary-rgb),0.4);
}

/* icon buttons */
.topbar-icon-btn {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.topbar-icon-btn:hover {
    background: var(--surface-strong);
    border-color: var(--border);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.topbar-icon-btn:active {
    transform: translateY(0);
    box-shadow: none;
}

/* notification badge */
.topbar-notif-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 6px var(--danger);
    border: 1.5px solid var(--background);
}

/* user chip */
.topbar-user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 12px 5px 5px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border);
    border-radius: 40px;
    transition: all var(--transition-fast);
    cursor: default;
}

.topbar-user-chip:hover {
    background: var(--surface-strong);
    border-color: var(--border-strong);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

/* avatar */
.topbar-avatar-wrap {
    position: relative;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid var(--primary);
}

.topbar-avatar-ring {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid transparent;
    background: linear-gradient(135deg, var(--primary), transparent, var(--primary-light)) border-box;
    -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: destination-out;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    mask-composite: exclude;
    animation: ringRotate 3s linear infinite;
    opacity: 0.7;
}

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

.topbar-user-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar-user-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 110px;
    line-height: 1.2;
}

.topbar-user-role {
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--primary);
    white-space: nowrap;
    line-height: 1.2;
}

/* logout button */
.topbar-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    background: linear-gradient(135deg, var(--danger), #c0392b);
    color: #fff;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,70,86,0.4);
    transition: all var(--transition-fast);
    box-shadow: 0 2px 10px rgba(255,71,87,0.3);
    flex-shrink: 0;
    white-space: nowrap;
}

.topbar-logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255,71,87,0.5);
    background: linear-gradient(135deg, #ff6370, var(--danger));
}

.topbar-logout-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(255,71,87,0.3);
}

/* page content gets its own padding now */
.page {
    display: none;
    animation: pageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: var(--spacing-2xl);
}

.page.active {
    display: block;
}



@keyframes pageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: var(--spacing-xl);
    animation: staggerFade 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.page-header h1 {
    color: var(--text-primary);
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.025em;
}

.page-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 400;
}

/* Search Box */
.search-box {
    display: flex;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
    max-width: 700px;
    animation: staggerFade 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input {
    flex: 1;
    padding: var(--spacing-md) var(--spacing-lg);
    border: 1px solid var(--border);
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all var(--transition-base);
}

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

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
    background: var(--surface-strong);
}

.search-btn,
.btn-primary {
    padding: var(--spacing-md) var(--spacing-xl);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

.search-btn:hover,
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(var(--primary-rgb), 0.4);
}

.search-btn:active,
.btn-primary:active {
    transform: translateY(0);
}

.btn-danger {
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--danger), #d32f2f);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(255, 82, 82, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 82, 82, 0.4);
}

.btn-edit {
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--warning), #f57c00);
    color: var(--text-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-base);
    box-shadow: 0 4px 12px rgba(255, 171, 0, 0.3);
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 171, 0, 0.4);
}

.btn-secondary {
    padding: var(--spacing-md) var(--spacing-xl);
    background: var(--surface-strong);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
}

.btn-secondary:hover {
    background: var(--surface-stronger);
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Custom Accessible Checkbox (Toggle Switch style) */
.custom-checkbox {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    cursor: pointer;
    user-select: none;
    padding: var(--spacing-sm) 0;
}

.custom-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.checkbox-box {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    background: var(--surface-stronger);
    position: relative;
    transition: background 0.3s, border-color 0.3s;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.checkbox-box::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background 0.3s;
}

.custom-checkbox input[type="checkbox"]:checked ~ .checkbox-box {
    background: var(--primary);
    border-color: var(--primary-light);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.4);
}

.custom-checkbox input[type="checkbox"]:checked ~ .checkbox-box::after {
    transform: translateX(20px);
    background: #fff;
}

.custom-checkbox:hover .checkbox-box {
    border-color: var(--primary-light);
}

.custom-checkbox input[type="checkbox"]:focus-visible ~ .checkbox-box {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.custom-checkbox input[type="checkbox"]:disabled ~ .checkbox-box {
    opacity: 0.5;
    cursor: not-allowed;
}

.custom-checkbox input[type="checkbox"]:disabled ~ .checkbox-label {
    color: var(--text-disabled);
    cursor: not-allowed;
}

.checkbox-label {
    color: var(--text-secondary);
    font-weight: 500;
    transition: color var(--transition-base);
}

.custom-checkbox:hover .checkbox-label {
    color: var(--text-primary);
}

/* Loading */
.loading {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin: var(--spacing-lg) 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.loading::before {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--surface-strong);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.hidden {
    display: none !important;
}

/* Result Container */
.result-container {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-top: var(--spacing-lg);
    box-shadow: var(--shadow-soft);
    animation: resultSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes resultSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    color: var(--text-primary);
}

.result-card h3 {
    font-size: 1.4rem;
    margin-bottom: var(--spacing-lg);
    color: var(--text-primary);
    font-weight: 700;
}

.result-detail {
    display: flex;
    justify-content: space-between;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid var(--border);
}

.result-detail:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-muted);
    font-weight: 500;
}

.result-value {
    color: var(--text-primary);
    font-weight: 600;
}

/* User card style for Discord search */
.user-card {
    display: flex;
    gap: var(--spacing-xl);
    align-items: flex-start;
    padding: var(--spacing-xl);
    background: var(--surface-strong);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.user-card-avatar {
    width: 120px;
    height: 120px;
    border-radius: var(--radius-xl);
    border: 4px solid var(--primary);
    box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.3);
}

.user-card-info {
    flex: 1;
}

.user-card-name {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--spacing-xs);
}

.user-card-username {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

.user-card-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

/* Table Container */
.table-container {
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-top: var(--spacing-lg);
    box-shadow: var(--shadow-soft);
}

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

th, td {
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: left;
    color: var(--text-primary);
}

th {
    background: var(--surface-strong);
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr {
    border-bottom: 1px solid var(--border);
    transition: all var(--transition-fast);
}

tr:hover {
    background: var(--surface-strong);
}

tr:last-child {
    border-bottom: none;
}

.table-actions {
    display: flex;
    gap: var(--spacing-sm);
}

/* Pagination */
.pagination {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    margin-top: var(--spacing-xl);
}

.page-btn {
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-base);
    font-weight: 500;
}

.page-btn:hover {
    background: var(--surface-strong);
    border-color: var(--primary);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.page-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(var(--primary-rgb), 0.3);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 900px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-hover);
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure modal-body content never slides under the close (×) button */
#modal-body {
    padding-top: 44px;
}

/* Custom Perk Modal Specific Styles */
.custom-perk-modal {
    width: 100%;
}

.custom-perk-modal .modal-content {
    padding: var(--spacing-2xl);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(40px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-btn {
    position: absolute;
    top: var(--spacing-md);
    right: var(--spacing-lg);
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-base);
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
}

.close-btn:hover {
    color: var(--text-primary);
    background: var(--surface-strong);
}

.modal-content h2 {
    color: var(--text-primary);
    margin-bottom: var(--spacing-lg);
    font-weight: 800;
    font-size: 1.6rem;
}

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    font-size: 0.95rem;
}

.form-group input {
    width: 100%;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    background: var(--surface-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all var(--transition-base);
}

.form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.15);
    background: var(--surface-stronger);
}

.form-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    margin-top: var(--spacing-xl);
}

/* Arabic Support - RTL removed as per request */

/* ═══════════════════════════════════════════════════════
   RESPONSIVE EXTENSIONS (supplements the mobile rules below)
   ═══════════════════════════════════════════════════════ */

@media (max-width: 1024px) {
    .sidebar { width: 260px; }
    .main-content { padding: var(--spacing-xl); }
}

@media (max-width: 768px) {
    /* ── Search / filter rows ── */
    .search-box { flex-direction: column; gap: 8px; }
    .search-box input, .search-box select, .search-box button { width: 100%; }

    /* ── Tables: horizontal scroll wrapper ── */
    .table-container { overflow-x: auto; }
    table { min-width: 520px; }

    /* ── Stats / info grids ── */
    .stats-grid, .info-grid { grid-template-columns: 1fr !important; }

    /* ── User cards ── */
    .user-card { flex-direction: column; align-items: flex-start; gap: 10px; }

    /* ── Profile card ── */
    .profile-card { flex-direction: column; align-items: center; padding: 20px 14px; gap: 16px; }
    .profile-avatar { width: 100px; height: 100px; }

    /* ── Perks grid ── */
    .perks-grid { grid-template-columns: 1fr !important; }

    /* ── Discord Logs two-panel layout ── */
    #dl-wrap { flex-direction: column !important; height: auto !important; }
    #dl-list  { width: 100% !important; border-right: none !important; border-bottom: 1px solid var(--border); max-height: 220px; padding: 0 0 10px 0 !important; }
    #dl-main  { padding: 12px 0 0 0 !important; }
    .dl-row2, .dl-row3 { grid-template-columns: 1fr !important; }

    /* ── Admin permissions two-panel ── */
    #adminPermsList { width: 100% !important; position: static !important; max-height: 220px; }
    #adminPermsEditor { min-width: 0 !important; width: 100% !important; }

    /* ── Modals: 96vw centered ── */
    .modal-content,
    .modal-box {
        width: 96vw !important;
        max-width: 96vw !important;
        min-width: 0 !important;
        max-height: 90dvh;
        overflow-y: auto;
        margin: 8px auto;
        border-radius: 14px;
    }

    /* ── Page header shrink ── */
    .page-header h1 { font-size: 1.6rem; }
}

@media (max-width: 480px) {
    .page-header h1 { font-size: 1.2rem; }

    /* Navigation items: larger tap targets */
    .nav-item { padding: 12px 14px !important; font-size: 0.95rem; }

    /* Table font size */
    th, td { font-size: 0.78rem; }

    /* Modals: bottom sheet on very small screens */
    .modal-content, .modal-box {
        width: 100vw !important;
        max-width: 100vw !important;
        border-radius: 16px 16px 0 0 !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        max-height: 88dvh;
    }
}

/* Profile Page Styling */
.profile-container {
    display: flex;
    justify-content: center;
    padding-top: var(--spacing-md);
}

.profile-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-2xl);
    box-shadow: var(--shadow-soft);
    width: 100%;
    max-width: 700px;
    display: flex;
    gap: var(--spacing-xl);
    flex-wrap: wrap;
    backdrop-filter: blur(12px);
    animation: fadeInUp 0.5s var(--transition-base);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-avatar-container {
    flex-shrink: 0;
}

.profile-avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    border: 3px solid var(--primary-light);
    box-shadow: var(--shadow-hover);
    object-fit: cover;
}

.profile-details {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.profile-field {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.profile-field.full-width {
    flex-direction: column;
}

.field-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.field-value {
    font-size: 1.125rem;
    color: var(--text-primary);
    font-weight: 500;
}

.user-ids-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-xs);
}

.user-id-item {
    background: var(--surface-strong);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-sm);
}

.id-value {
    font-weight: 700;
    color: var(--accent);
}

.id-date {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Responsive profile */
@media (max-width: 768px) {
    .profile-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: var(--spacing-xl);
    }
    
    .profile-field {
        align-items: center;
    }
    
    .user-id-item {
        flex-direction: column;
        text-align: center;
        gap: var(--spacing-xs);
    }
}

@media (max-width: 480px) {
    .login-box {
        padding: var(--spacing-lg);
    }

    .login-box h1 {
        font-size: 2.25rem;
    }

    .sidebar {
        padding: var(--spacing-md);
    }

    .page-header h1 {
        font-size: 1.75rem;
    }
}
.hoverable-row:hover { background-color: rgba(255,255,255,0.05) !important; transition: background-color 0.2s; }

.glow-text {
    color: var(--primary);
    font-weight: 800 !important;
}

/* =========================================
   HAMBURGER MENU BUTTON (mobile only)
   ========================================= */
.hamburger-btn {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 1000;
    background: var(--surface-strong);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar overlay on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
    backdrop-filter: blur(2px);
}

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

/* =========================================
   TABLET (max 900px)
   ========================================= */
@media (max-width: 900px) {
    .dashboard-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        padding: var(--spacing-md) var(--spacing-lg);
        align-items: center;
        gap: var(--spacing-md);
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-header {
        margin-bottom: 0 !important;
        border-bottom: none !important;
        padding-bottom: 0 !important;
    }

    .sidebar-header img { height: 36px !important; }
    .sidebar-header h2 { font-size: 1.2rem; }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: var(--spacing-xs);
    }

    .nav-item {
        padding: var(--spacing-sm) var(--spacing-md);
        font-size: 0.9rem;
    }

    .nav-item:hover { transform: translateY(-2px); }

    .sidebar-footer {
        padding-top: 0;
        border-top: none;
        display: flex;
        align-items: center;
        gap: var(--spacing-md);
        flex-wrap: wrap;
    }

    .user-info { margin-bottom: 0; }

    .main-content { padding: 0; }
    .page { padding: var(--spacing-xl); }

    .topbar-greeting { display: none; }
    .topbar-status-dot { display: none; }
    .top-bar { padding: 0 16px; height: 56px; }
}

/* =========================================
   MOBILE (max 640px)
   ========================================= */
@media (max-width: 640px) {
    /* Show hamburger, hide sidebar by default */
    .hamburger-btn { display: flex; }

    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px !important;
        height: 100dvh;           /* dvh = visible height, avoids Chrome bottom bar overlap */
        max-height: 100dvh;
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        z-index: 100;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
        overflow-x: hidden;
        padding: var(--spacing-xl) var(--spacing-lg) !important;
        padding-bottom: calc(var(--spacing-xl) + env(safe-area-inset-bottom, 24px)) !important;
        border-right: 1px solid var(--border) !important;
        border-bottom: none !important;
    }

    .sidebar.mobile-open { left: 0; }

    .sidebar-header {
        margin-bottom: var(--spacing-lg) !important;
        border-bottom: 1px solid var(--border) !important;
        padding-bottom: var(--spacing-lg) !important;
    }

    .sidebar-nav {
        flex-direction: column !important;
        flex-wrap: nowrap !important;
        width: 100%;
    }

    .nav-item {
        width: 100%;
        padding: var(--spacing-md) var(--spacing-lg);
        font-size: 1rem;
    }

    .sidebar-footer {
        flex-direction: column !important;
        align-items: stretch !important;
        padding-top: var(--spacing-lg);
        border-top: 1px solid var(--border) !important;
        margin-top: auto;
        width: 100%;
    }

    /* Main content takes full width */
    .main-content { padding: 0; }
    .page { padding: var(--spacing-md); }

    /* Topbar adjustments for mobile */
    .top-bar { padding: 0 14px; height: 52px; }
    .topbar-greeting { display: none; }
    .topbar-status-dot { display: none; }
    .topbar-user-name { max-width: 70px; }
    .topbar-logout-btn span { display: none; }
    .topbar-logout-btn { padding: 7px 10px; gap: 0; }

    /* Login page */
    .login-container { padding: var(--spacing-md); }
    .login-box { padding: var(--spacing-xl) var(--spacing-lg); }
    .login-box h1 { font-size: 2rem; }

    /* Page header */
    .page-header h1 { font-size: 1.75rem; }
    .page-header p { font-size: 0.95rem; }

    /* Search box */
    .search-box {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    .search-btn, .btn-primary { width: 100%; }

    /* Tables — make them scroll horizontally */
    .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 550px; }
    th, td { padding: var(--spacing-sm) var(--spacing-md); font-size: 0.875rem; }

    /* ID Management top bar */
    #page-id-management > div[style] {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    #page-id-management > div[style] .search-input { min-width: 0; flex: 1 1 100%; }
    #page-id-management > div[style] button { flex: 1; }

    /* Modal */
    .modal-content {
        margin: var(--spacing-md) !important;
        width: calc(100% - 2rem) !important;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Profile */
    .profile-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: var(--spacing-lg);
    }

    .profile-field { align-items: center; }

    /* Buttons in tables */
    .btn-danger, .btn-edit {
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: 0.8rem;
    }

    /* Forms */
    .form-actions {
        flex-direction: column;
        gap: var(--spacing-sm);
    }
    .form-actions button { width: 100%; }

    /* Lang switcher */
    .lang-switcher { gap: var(--spacing-sm); }
    .lang-btn { padding: var(--spacing-sm) var(--spacing-md); font-size: 0.9rem; }
}

/* =========================================
   SMALL PHONES (max 380px)
   ========================================= */
@media (max-width: 380px) {
    .login-box h1 { font-size: 1.6rem; }
    .page-header h1 { font-size: 1.4rem; }
    .nav-icon { font-size: 1.1rem; }
    .user-avatar { width: 36px; height: 36px; }
}

/* =========================================
   CUSTOM UI COMPONENTS (Toasts, Switches, Toolbars)
   ========================================= */

/* Custom Toast Alerts */
#toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-toast {
    background: var(--surface-strong);
    color: var(--text-primary);
    padding: 15px 20px;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.custom-toast.show {
    transform: translateX(0);
}

.custom-toast.success { border-left-color: var(--success); }
.custom-toast.error { border-left-color: var(--danger); }
.custom-toast.warning { border-left-color: var(--accent); }

/* Toggle Switch */
.switch-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.95rem;
}
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}
.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--border);
    transition: .4s;
    border-radius: 24px;
}
.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}
input:checked + .slider {
    background-color: var(--primary);
}
input:checked + .slider:before {
    transform: translateX(22px);
}

/* Toolbars */
.format-toolbar {
    display: flex;
    gap: 5px;
    background: var(--surface-strong);
    padding: 8px;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    flex-wrap: wrap;
    border: 1px solid var(--border);
}

.color-swatch {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.2s;
}
.color-swatch:hover {
    transform: scale(1.15);
}

.format-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}
.format-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Perk Cards */
.perk-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}
.perk-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.2s, box-shadow 0.2s;
}
.perk-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    border-color: var(--primary);
}
.perk-card h3 {
    margin-top: 0;
    color: var(--text-primary);
}
.perk-card .desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    border-radius: var(--radius-sm);
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Admin Permissions Page
   ═══════════════════════════════════════════════════════════════════════════ */

#adminPermsList {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-right: 4px;
}

#adminPermsList::-webkit-scrollbar { width: 4px; }
#adminPermsList::-webkit-scrollbar-track { background: transparent; }
#adminPermsList::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.ap-admin-card {
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface-strong);
    transition: all 0.18s ease;
    user-select: none;
}

.ap-admin-card:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.07);
    transform: translateX(2px);
}

.ap-admin-card--active {
    border-color: var(--primary) !important;
    background: rgba(99, 102, 241, 0.12) !important;
}

#adminPermsEditor {
    flex: 1;
    min-width: 320px;
}

.ap-toggle {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

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

.ap-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    border-radius: 24px;
    transition: background 0.2s ease;
}

.ap-group {
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
    transition: box-shadow 0.2s ease;
}

.ap-group:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.15); }

#ap-save-bar {
    position: sticky;
    bottom: 0;
    padding: 14px 0 6px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
}

.ap-save-btn {
    padding: 10px 28px;
    background: linear-gradient(90deg, var(--primary), #8b5cf6);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 800;
    font-size: 0.95rem;
    box-shadow: 0 4px 14px rgba(99,102,241,0.4);
    transition: all 0.2s ease;
}

.ap-save-btn:hover { filter: brightness(1.12); transform: translateY(-1px); }
.ap-save-btn:active { transform: translateY(0); }
.ap-save-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

@media (max-width: 768px) {
    #adminPermsList {
        width: 100%;
        position: static;
        max-height: 260px;
    }
    #adminPermsEditor { min-width: 0; width: 100%; }
}


/* =====================================================================
   Wink look
   ===================================================================== */

body { background: var(--background); color: var(--text-primary); -webkit-font-smoothing: antialiased; }
html[lang="ar"] body :where(p, h1, h2, h3, h4, span, div, td, th, label, button, a, li, small, strong) { unicode-bidi: plaintext; }
::selection { background: var(--primary); color: var(--on-primary); }

/* headings: plain Wink type instead of neon gradient text */
h1, h2, h3, .page-header h1, .login-box h1 {
    font-family: var(--font-head);
    background: none !important;
    -webkit-text-fill-color: currentColor !important;
    color: var(--text-primary);
    text-shadow: none !important;
    letter-spacing: 0;
}
.page-header p { color: var(--text-secondary); }

/* amber fills need dark text */
.discord-btn, .lang-btn.active, .nav-item.active, .topbar-lang-switcher .lang-btn.active,
.search-btn, .btn-primary, .page-btn.active, .format-btn:hover {
    color: var(--on-primary);
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 8px 20px -12px rgba(var(--primary-rgb), .8);
    text-shadow: none;
}
.discord-btn:hover, .search-btn:hover, .btn-primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.nav-item.active .nav-icon, .nav-item.active svg { filter: none; }

/* the "Login with Discord" button stays Discord blue */
.discord-btn { background: #5865F2 !important; border-color: #5865F2 !important; color: #fff !important; box-shadow: 0 10px 24px -14px rgba(88, 101, 242, .9) !important; }
.discord-btn:hover { background: #6D78F5 !important; }

/* calmer panels: less glass, less glow */
.sidebar, .topbar { background: rgba(10, 17, 31, .92) !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; border-color: var(--border) !important; }
.table-container, .profile-card, .search-box, .result-container, .modal-content, .stat-card {
    border-color: var(--border) !important;
    box-shadow: var(--shadow-soft) !important;
}
[class*="glow"], .bg-blob, .login-box::before, .login-box::after { filter: none; }
.sidebar-logo img, .sidebar img[alt=""] { filter: none !important; border-radius: 12px; }
input, select, textarea { font-family: var(--font-body); }
.search-input:focus, input:focus, select:focus, textarea:focus { border-color: var(--primary) !important; box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .15) !important; outline: none; }

/* tables: long cells no longer push the last column (date) out of view */
.table-container { overflow-x: auto !important; }
.table-container table { width: 100%; }
.table-container table { min-width: 720px; }
.table-container td, .table-container th { vertical-align: middle; }

/* profile picture: always round, never a broken box */
.profile-avatar, .topbar-avatar { object-fit: cover; background: #1D2C4C; }

/* phones: the menu button and the top bar no longer overlap */
@media (max-width: 768px) {
    .topbar { padding-inline-start: 72px !important; gap: 8px; }
    .topbar-user-text { display: none; }
    .topbar-divider { display: none; }
}

/* =====================================================================
   Sign-in page
   ===================================================================== */
body.wink-login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background:
    radial-gradient(700px 320px at 15% 10%, rgba(var(--primary-rgb), .10), transparent 70%),
    radial-gradient(600px 300px at 90% 90%, rgba(93, 169, 246, .08), transparent 70%), var(--background); }
.wl-shell { width: min(980px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-radius: 24px; overflow: hidden;
    border: 1px solid var(--border); background: rgba(18, 29, 51, .85); box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .9); }
.wl-card { padding: clamp(28px, 5vw, 52px); display: flex; flex-direction: column; gap: 22px; }
.wl-brand { display: flex; align-items: center; gap: 12px; font: 800 22px/1 var(--font-head); color: var(--text-primary); }
.wl-brand img { border-radius: 12px; }
.wl-tag { margin-inline-start: auto; font: 600 12px/1 var(--font-body); color: var(--primary); border: 1px solid rgba(var(--primary-rgb), .35);
    background: rgba(var(--primary-rgb), .08); padding: 6px 10px; border-radius: 999px; }
.wl-copy h1 { font-size: clamp(34px, 5vw, 46px); line-height: 1.1; margin-bottom: 10px; }
.wl-lede { color: var(--text-secondary); font-size: 16px; line-height: 1.7; max-width: 40ch; }
.wl-notice { padding: 12px 14px; border-radius: 12px; background: rgba(240, 113, 106, .12); border: 1px solid rgba(240, 113, 106, .35); color: #FFD3CF; font-size: 14px; }
.wl-discord { width: 100%; justify-content: center; padding: 14px 20px; border-radius: 14px; font-weight: 700; font-size: 16px; }
.wl-safe { color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.wl-lang { margin-top: 4px; }
.wl-art { position: relative; padding: clamp(28px, 5vw, 52px); display: flex; flex-direction: column; justify-content: center; gap: 22px;
    background: linear-gradient(160deg, rgba(var(--primary-rgb), .10), rgba(12, 20, 36, .4) 55%); border-inline-start: 1px solid var(--border); }
.wl-art p { color: var(--text-secondary); font-size: 15px; line-height: 1.7; max-width: 34ch; }
.wl-idcard { width: min(320px, 100%); padding: 22px; border-radius: 18px; background: #13203A; border: 1px solid rgba(var(--primary-rgb), .3);
    box-shadow: 0 24px 50px -30px rgba(0, 0, 0, .9); transform: rotate(-3deg); display: flex; flex-direction: column; gap: 12px; }
.wl-idcard-top { display: flex; align-items: center; gap: 8px; font: 700 12px/1 var(--font-body); letter-spacing: .12em; color: var(--text-muted); }
.wl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(var(--success-rgb), .15); }
.wl-idnum { font: 800 44px/1 var(--font-head); color: var(--primary); }
.wl-idrow { height: 10px; border-radius: 6px; background: rgba(255, 255, 255, .05); }
.wl-bar { display: block; height: 100%; border-radius: 6px; background: #2A3A5C; }
.wl-bar.short { background: #22324F; }
.wl-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.wl-chips span { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: rgba(var(--success-rgb), .12); color: var(--success); }
.wl-chips span.amber { background: rgba(var(--primary-rgb), .12); color: var(--primary); }
@media (max-width: 760px) {
    .wl-shell { grid-template-columns: 1fr; }
    .wl-art { display: none; }
}

/* buttons that bring their own colour keep readable text */
.btn-primary[style*="--surface"], .search-btn[style*="--surface"] { color: var(--text-primary); box-shadow: none; }
.btn-primary[style*="--danger"], .search-btn[style*="--danger"] { color: #fff; box-shadow: none; }
.btn-primary[style*="--success"], .btn-primary[style*="--warning"] { color: #0C1424; box-shadow: none; }
