/* Project: Nexis Admin Dashboard | Version: 1.0.0 | Author: Nexis Studio | Premium SaaS Framework */

/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Cairo:wght@400;600;700&display=swap');

:root {
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);

    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --success-500: #10b981;
    --danger-500: #ef4444;
    --warning-500: #f59e0b;

    --font-main: 'Outfit', sans-serif;
    --font-ar: 'Cairo', sans-serif;
}

.dark {
    /* Slate-950 based background for deep premium feel */
    --glass-bg: rgba(2, 6, 23, 0.85);
    --glass-border: rgba(30, 41, 59, 0.6);
    /* Slate-800 */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);

    /* Re-enforce Slate text colors via utility overrides if needed, 
       but primarily handled by Tailwind classes. 
       Here we set global defaults for dark mode if not utility-controlled */
    color: #cbd5e1;
    /* Slate-300 */
}

body {
    font-family: var(--font-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body[lang="ar"] {
    font-family: var(--font-ar);
}

/* Glassmorphism Utility */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

/* Sidebar Active State */
.nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%);
    color: var(--primary-600);
    border-left: 3px solid var(--primary-500);
}

.dark .nav-link.active {
    background: linear-gradient(90deg, rgba(99, 102, 241, 0.2) 0%, rgba(99, 102, 241, 0.05) 100%);
    color: var(--primary-500);
    border-left: 3px solid var(--primary-500);
}

/* RTL Active State Flip */
html[dir="rtl"] .nav-link.active {
    border-left: none;
    border-right: 3px solid var(--primary-500);
}

/* Command Palette (Ctrl+K) */
#command-palette {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: none;
    /* Toggled by JS */
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

#command-palette.open {
    display: flex;
    opacity: 1;
}

.cmd-modal {
    width: 600px;
    max-width: 90%;
    max-height: 80vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s ease-in-out;
}

.dark .cmd-modal {
    background: #1f2937;
    border: 1px solid #374151;
}

#command-palette.open .cmd-modal {
    transform: scale(1);
}

.cmd-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dark .cmd-item {
    border-bottom: 1px solid #374151;
    color: #e5e7eb;
}

.cmd-item:hover,
.cmd-item.selected {
    background: #f3f4f6;
}

.dark .cmd-item:hover,
.dark .cmd-item.selected {
    background: #374151;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 110;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

html[dir="rtl"] #toast-container {
    right: auto;
    left: 1.5rem;
}

.toast {
    pointer-events: auto;
    background: white;
    color: #1f2937;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid var(--primary-500);
    min-width: 320px;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.dark .toast {
    background: #1f2937;
    color: #f3f4f6;
    border-color: rgba(75, 85, 99, 0.5);
    border-left-color: var(--primary-500);
}

html[dir="rtl"] .toast {
    transform: translateX(-100%);
    border-left: none;
    border-right: 4px solid var(--primary-500);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
    background: #4b5563;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Animations */
@keyframes shake {

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

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-4px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(4px);
    }
}

.shake-anim {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

/* Pulse Animation (for avatars/status) */
.pulse-ring {
    position: relative;
}

.pulse-ring::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: inherit;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: -1;
    opacity: 0.6;
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* ApexCharts Dark Mode Overrides */
.dark .apexcharts-tooltip {
    background: #1f2937 !important;
    border-color: #374151 !important;
    color: #f3f4f6 !important;
}

.dark .apexcharts-tooltip-title {
    background: #111827 !important;
    border-bottom: 1px solid #374151 !important;
}

.dark .apexcharts-xaxis-label,
.dark .apexcharts-yaxis-label {
    fill: #9ca3af !important;
}