/* ============================================================
   ROOT VARIABLES – PREMIUM GLASSMORPHISM THEME
   ============================================================ */
@import url('../vendor/css/Vazirmatn-font-face.css');

:root {
    /* Light Theme */
    --bg-body: #f0f2f5;
    --bg-card: rgba(255, 255, 255, 0.7);
    --bg-sidebar: rgba(255, 255, 255, 0.85);
    --bg-navbar: rgba(255, 255, 255, 0.85);
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-sidebar: #4b5563;
    --text-sidebar-active: #2563eb;
    --border-color: rgba(255, 255, 255, 0.3);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.01);
    
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;

    --sidebar-width: 280px;
    --topbar-height: 70px;
    --transition-speed: 0.4s;
    --glass-blur: blur(16px);
}

[data-theme="dark"] {
    --bg-body: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-sidebar: rgba(15, 23, 42, 0.85);
    --bg-navbar: rgba(15, 23, 42, 0.85);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #60a5fa;
    --border-color: rgba(255, 255, 255, 0.05);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
    --shadow-card: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    
    --color-primary: #3b82f6;
    --color-primary-hover: #60a5fa;
}

/* Dark Mode text overrides */
[data-theme="dark"] .text-dark:not(.badge):not(.btn):not(.btn-warning):not(.btn-danger):not(.btn-success):not(.btn-info):not(.badge-warning):not(.bg-warning):not(.bg-info):not(.btn-light) {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-muted {
    color: var(--text-secondary) !important;
}

/* Dark Mode background and border overrides */
[data-theme="dark"] .bg-white:not(.bg-opacity-10):not(.bg-opacity-25):not(.bg-opacity-50):not(.bg-opacity-75) {
    background-color: var(--bg-card) !important;
}

[data-theme="dark"] .bg-light:not(.badge):not(.btn) {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

[data-theme="dark"] .border-light {
    border-color: var(--border-color) !important;
}

/* ============================================================
   GLOBAL STYLES
   ============================================================ */
body {
    font-family: 'Vazirmatn', 'Segoe UI', Tahoma, sans-serif;
    background-color: var(--bg-body);
    background-image: 
        radial-gradient(at 0% 0%, hsla(199, 89%, 48%, 0.06) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(199, 89%, 48%, 0.08) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(210, 100%, 50%, 0.05) 0, transparent 50%);
    color: var(--text-primary);
    direction: rtl;
    transition: background-color var(--transition-speed), color var(--transition-speed);
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-body);
}
::-webkit-scrollbar-thumb {
    background: rgba(37, 99, 235, 0.4);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(37, 99, 235, 0.8);
}

[data-theme="dark"] body {
    background-image: 
        radial-gradient(at 0% 0%, hsla(222, 47%, 11%, 1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(199, 89%, 30%, 0.15) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(200, 50%, 20%, 0.2) 0, transparent 50%);
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--color-primary-hover);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 20px;
    right: 20px;
    bottom: 20px;
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    color: var(--text-sidebar);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    z-index: 1040;
    transition: transform var(--transition-speed);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 10px;
}

.sidebar .sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 20px;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--color-primary);
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
    background: linear-gradient(45deg, var(--color-primary), var(--color-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar .nav-link {
    color: var(--text-sidebar);
    padding: 14px 24px;
    margin: 4px 16px;
    border-radius: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 1rem;
    font-weight: 500;
}

.sidebar .nav-link:hover {
    background: rgba(37, 99, 235, 0.1);
    color: var(--color-primary);
    transform: translateX(-5px);
}

.sidebar .nav-link.active {
    background: var(--color-primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar .nav-link i {
    font-size: 1.25rem;
    width: 26px;
    text-align: center;
}

.sidebar .text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--color-danger);
}

/* Sidebar Blue Theme Switch */
.sidebar.sidebar-blue {
    background: linear-gradient(135deg, rgba(239, 246, 255, 0.92) 0%, rgba(219, 234, 254, 0.82) 100%) !important;
    border-color: rgba(147, 197, 253, 0.45) !important;
    box-shadow: 0 10px 30px -5px rgba(37, 99, 235, 0.08), 0 8px 15px -6px rgba(37, 99, 235, 0.03) !important;
}
.sidebar.sidebar-blue .nav-link {
    color: #1e40af !important;
}
.sidebar.sidebar-blue .nav-link i {
    color: #3b82f6 !important;
}
.sidebar.sidebar-blue .nav-link.active {
    background: var(--color-primary) !important;
    color: #ffffff !important;
}
.sidebar.sidebar-blue .nav-link.active i {
    color: #ffffff !important;
}
.sidebar.sidebar-blue .nav-link:hover {
    background: rgba(37, 99, 235, 0.12) !important;
    color: #2563eb !important;
}
.sidebar.sidebar-blue .nav-link:hover i {
    color: #2563eb !important;
}
.sidebar.sidebar-blue .sidebar-brand {
    border-bottom-color: rgba(147, 197, 253, 0.4) !important;
}

/* Dark Mode Sidebar Blue Theme (Becomes deep beautiful space/dark-blue gradient) */
[data-theme="dark"] .sidebar.sidebar-blue {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.95) 0%, rgba(23, 37, 84, 0.85) 100%) !important;
    border-color: rgba(59, 130, 246, 0.25) !important;
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.35) !important;
}
[data-theme="dark"] .sidebar.sidebar-blue .nav-link {
    color: #93c5fd !important;
}
[data-theme="dark"] .sidebar.sidebar-blue .nav-link i {
    color: #60a5fa !important;
}
[data-theme="dark"] .sidebar.sidebar-blue .nav-link.active {
    background: var(--color-primary) !important;
    color: #ffffff !important;
}
[data-theme="dark"] .sidebar.sidebar-blue .nav-link.active i {
    color: #ffffff !important;
}
[data-theme="dark"] .sidebar.sidebar-blue .nav-link:hover {
    background: rgba(59, 130, 246, 0.15) !important;
    color: #60a5fa !important;
}
[data-theme="dark"] .sidebar.sidebar-blue .nav-link:hover i {
    color: #3b82f6 !important;
}
[data-theme="dark"] .sidebar.sidebar-blue .sidebar-brand {
    border-bottom-color: rgba(59, 130, 246, 0.2) !important;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    position: fixed;
    top: 20px;
    left: 20px;
    right: calc(var(--sidebar-width) + 40px);
    height: var(--topbar-height);
    background: var(--bg-navbar);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1030;
    transition: right var(--transition-speed);
}

.topbar .toggle-sidebar {
    font-size: 1.5rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--text-primary);
    transition: transform 0.3s;
}
.topbar .toggle-sidebar:hover {
    transform: scale(1.1);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(37, 99, 235, 0.1);
    padding: 6px 16px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--color-primary);
}

.theme-toggle {
    font-size: 1.3rem;
    cursor: pointer;
    background: rgba(37, 99, 235, 0.1);
    border: none;
    color: var(--color-primary);
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.theme-toggle:hover {
    background: var(--color-primary);
    color: white;
    transform: rotate(30deg);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
    margin-right: calc(var(--sidebar-width) + 40px);
    margin-top: calc(var(--topbar-height) + 40px);
    padding: 1rem 20px;
    transition: margin-right var(--transition-speed);
}

/* ============================================================
   CARDS & COMPONENTS
   ============================================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: var(--shadow-card);
    transition: transform 0.3s, box-shadow 0.3s;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.1);
}

.card-header {
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 1.1rem;
    padding: 1.2rem 1.5rem;
    color: var(--text-primary);
}

.card-body {
    padding: 1.5rem;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive {
    border-radius: 12px;
}

.table {
    color: var(--text-primary);
    border-collapse: separate;
    border-spacing: 0 8px;
    margin-top: -8px;
}

.table th {
    background: transparent;
    border: none;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 1rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr {
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
    border-radius: 12px;
}

.table tbody tr:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-card);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(37, 99, 235, 0.02);
}

[data-theme="dark"] .table-striped tbody tr:nth-of-type(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.table td {
    border: none;
    padding: 1.2rem 1rem;
    vertical-align: middle;
}
.table td:first-child {
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}
.table td:last-child {
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}

/* ============================================================
   BUTTONS & BADGES
   ============================================================ */
.btn {
    border-radius: 12px;
    padding: 0.6rem 1.2rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.btn:focus:not(:active)::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), #818cf8);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--color-primary-hover), var(--color-primary));
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.4);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--color-success), #34d399);
    color: white;
    box-shadow: 0 4px 10px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, var(--color-danger), #f87171);
    color: white;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, var(--color-info), #60a5fa);
    color: white;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}

.btn-warning {
    background: linear-gradient(135deg, var(--color-warning), #fbbf24);
    color: #212529;
    box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

.badge {
    border-radius: 30px;
    padding: 0.5em 1em;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.badge.bg-warning {
    color: #212529;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(120%);
        border-radius: 0;
        top: 0;
        bottom: 0;
        right: 0;
        width: 280px;
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .topbar {
        right: 20px;
        left: 20px;
        top: 20px;
    }

    .main-content {
        margin-right: 0;
    }
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    background: var(--bg-body);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 3rem;
    width: 420px;
    max-width: 90%;
    box-shadow: var(--shadow-card);
    text-align: center;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
.fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }

/* ============================================================
   CUSTOM CHECKLISTS
   ============================================================ */
.checklist-item {
    transition: all 0.3s ease;
    border-radius: 12px;
    margin-bottom: 6px;
    background: transparent;
}
.checklist-item:hover {
    background: rgba(37, 99, 235, 0.05);
    transform: translateX(-5px);
}
.checklist-item.completed .text-content {
    text-decoration: line-through;
    color: var(--text-secondary);
    opacity: 0.7;
}
.checklist-item.completed {
    background: rgba(16, 185, 129, 0.05);
}

.form-check-input.custom-check {
    width: 1.2rem;
    height: 1.2rem;
    margin-top: 0.15rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    border: 2px solid var(--color-primary);
}
.form-check-input.custom-check:checked {
    background-color: var(--color-success);
    border-color: var(--color-success);
    transform: scale(1.1);
}

/* ============================================================
   TABLE HOVER ANIMATION
   ============================================================ */
.table tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.table tbody tr:hover {
    transform: translateY(-2px) scale(1.005);
    box-shadow: 0 8px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    position: relative;
}

/* Input Focus Glow */
.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.25rem rgba(37, 99, 235, 0.25);
    transform: translateY(-1px);
    transition: all 0.3s ease;
}

/* ============================================================
   AVATAR PRESETS
   ============================================================ */
.preset-1 { background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%); }
.preset-2 { background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%); }
.preset-3 { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.preset-4 { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.preset-5 { background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%); }
.preset-6 { background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%); }
.preset-7 { background: linear-gradient(135deg, #ec4899 0%, #db2777 100%); }
.preset-8 { background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%); }
.preset-9 { background: linear-gradient(135deg, #84cc16 0%, #65a30d 100%); }
.preset-10 { background: linear-gradient(135deg, #f97316 0%, #ea580c 100%); }
.preset-11 { background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%); }
.preset-12 { background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%); }