/*
 * CashFlow Pro — Design System
 * Mobile-First Dark Mode Premium UI
 * Breakpoints: 480px → 768px → 1024px → 1200px
 */

/* ============================================================
   GOOGLE FONTS
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Noto+Sans+Arabic:wght@300;400;500;600;700;800&display=swap');

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
    /* Background */
    --bg-dark: #0f0f1a;
    --bg-card: #1a1a2e;
    --bg-surface: #252542;
    --bg-hover: #2d2d4a;
    --bg-input: #1e1e35;

    /* Accent Colors */
    --accent-primary: #6c5ce7;
    --accent-primary-light: #a29bfe;
    --accent-primary-dark: #5a4bd1;
    --accent-success: #00b894;
    --accent-success-light: #55efc4;
    --accent-danger: #e74c3c;
    --accent-danger-light: #ff7675;
    --accent-warning: #fdcb6e;
    --accent-warning-dark: #e17055;
    --accent-info: #74b9ff;
    --accent-info-dark: #0984e3;

    /* Text */
    --text-primary: #f1f1f1;
    --text-secondary: #a0a0b8;
    --text-muted: #636380;
    --text-inverse: #0f0f1a;

    /* Borders & Shadows */
    --border-color: rgba(108, 92, 231, 0.15);
    --border-light: rgba(255, 255, 255, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(108, 92, 231, 0.2);

    /* Layout */
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --bottomnav-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 50%;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Z-Index layers */
    --z-sidebar: 1050;
    --z-overlay: 1045;
    --z-topbar: 1040;
    --z-bottomnav: 1030;
    --z-fab: 1020;
    --z-modal: 1060;
    --z-toast: 1070;
}

/* ============================================================
   LIGHT THEME
   ============================================================ */
[data-theme="light"] {
    /* Background */
    --bg-dark: #f0f2f5;
    --bg-card: #ffffff;
    --bg-surface: #f5f6fa;
    --bg-hover: #eef0f4;
    --bg-input: #f8f9fb;

    /* Accent Colors — slightly richer for light bg */
    --accent-primary: #5f4dd0;
    --accent-primary-light: #7c6cf0;
    --accent-primary-dark: #4a3cb5;
    --accent-success: #0ca678;
    --accent-success-light: #38d9a9;
    --accent-danger: #e03131;
    --accent-danger-light: #ff6b6b;
    --accent-warning: #f59f00;
    --accent-warning-dark: #e67e22;
    --accent-info: #339af0;
    --accent-info-dark: #1971c2;

    /* Text */
    --text-primary: #1a1a2e;
    --text-secondary: #5c5c7a;
    --text-muted: #9999ad;
    --text-inverse: #ffffff;

    /* Borders & Shadows */
    --border-color: rgba(90, 75, 200, 0.12);
    --border-light: rgba(0, 0, 0, 0.06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 30px rgba(90, 75, 200, 0.08);
}

/* Light mode specific overrides */
[data-theme="light"] .sidebar {
    background: #ffffff;
    box-shadow: var(--shadow-md);
}
[data-theme="light"] .bottom-nav {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-sm);
}
[data-theme="light"] .card:hover {
    box-shadow: var(--shadow-md);
    border-color: rgba(90, 75, 200, 0.2);
}
[data-theme="light"] .card-glass {
    background: rgba(255, 255, 255, 0.85);
}
[data-theme="light"] .sidebar-brand {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="light"] .login-page {
    background: #f0f2f5;
}
[data-theme="light"] .login-page::before {
    background: radial-gradient(ellipse at 30% 50%, rgba(95, 77, 208, 0.06) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(12, 166, 120, 0.05) 0%, transparent 50%);
}
[data-theme="light"] .login-card {
    background: #ffffff;
    box-shadow: var(--shadow-lg);
}
[data-theme="light"] .login-title {
    background: linear-gradient(135deg, #1a1a2e, var(--accent-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
[data-theme="light"] .nav-link.active {
    background: linear-gradient(135deg, rgba(95, 77, 208, 0.12), rgba(95, 77, 208, 0.06));
}
[data-theme="light"] .filter-chip:hover,
[data-theme="light"] .filter-chip.active {
    background: rgba(95, 77, 208, 0.1);
}
[data-theme="light"] .kpi-expense .kpi-icon { background: rgba(224, 49, 49, 0.1); }
[data-theme="light"] .kpi-revenue .kpi-icon { background: rgba(12, 166, 120, 0.1); }
[data-theme="light"] .kpi-cashflow .kpi-icon { background: rgba(95, 77, 208, 0.1); }
[data-theme="light"] .kpi-tasks .kpi-icon { background: rgba(245, 159, 0, 0.1); }
[data-theme="light"] .kpi-trend.up { background: rgba(12, 166, 120, 0.1); }
[data-theme="light"] .kpi-trend.down { background: rgba(224, 49, 49, 0.1); }
[data-theme="light"] .transaction-icon.expense { background: rgba(224, 49, 49, 0.08); }
[data-theme="light"] .transaction-icon.revenue { background: rgba(12, 166, 120, 0.08); }
[data-theme="light"] .badge-success { background: rgba(12, 166, 120, 0.1); }
[data-theme="light"] .badge-danger { background: rgba(224, 49, 49, 0.1); }
[data-theme="light"] .badge-warning { background: rgba(245, 159, 0, 0.1); }
[data-theme="light"] .badge-info { background: rgba(51, 154, 240, 0.1); }
[data-theme="light"] .badge-primary { background: rgba(95, 77, 208, 0.1); }
[data-theme="light"] select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235c5c7a' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}
[data-theme="light"] .sidebar-overlay {
    background: rgba(0, 0, 0, 0.3);
}
[data-theme="light"] .bottom-nav-badge {
    border-color: #ffffff;
}
[data-theme="light"] .kanban-card {
    background: #f8f9fb;
}
[data-theme="light"] .attendance-btn.check-in:hover {
    background: rgba(12, 166, 120, 0.06);
}
[data-theme="light"] .attendance-btn.check-out:hover {
    background: rgba(224, 49, 49, 0.06);
}

/* ============================================================
   THEME TOGGLE BUTTON
   ============================================================ */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.95rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}
.theme-toggle:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: rotate(15deg);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
/* Dark mode: show sun icon (to switch to light) */
.theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
.theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}
/* Light mode: show moon icon (to switch to dark) */
[data-theme="light"] .theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}
[data-theme="light"] .theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Smooth body transition when switching themes */
body,
.sidebar,
.topbar,
.bottom-nav,
.card,
.transaction-item,
.form-control,
.btn-outline,
.filter-chip,
.kpi-card,
.kanban-card,
.kanban-column,
.login-card,
.login-page {
    transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* RTL Support */
[dir="rtl"] body {
    font-family: 'Noto Sans Arabic', 'Inter', -apple-system, sans-serif;
}

a {
    color: var(--accent-primary-light);
    text-decoration: none;
    transition: color var(--transition-fast);
}
a:hover { color: var(--accent-primary); }

img { max-width: 100%; height: auto; }

/* Prevent iOS zoom on inputs */
input, select, textarea, button {
    font-size: 16px !important;
    font-family: inherit;
}

/* ============================================================
   LAYOUT — MOBILE FIRST
   ============================================================ */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(var(--bottomnav-height) + 24px);
    max-width: 100%;
    min-height: 100vh;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 8px;
    z-index: var(--z-topbar);
    backdrop-filter: blur(12px);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition-fast);
    font-size: 1.1rem;
}
.topbar-hamburger:hover { background: var(--bg-hover); }

.topbar-greeting {
    display: flex;
    flex-direction: column;
}
.topbar-greeting small {
    color: var(--text-muted);
    font-size: 0.75rem;
}
.topbar-greeting strong {
    font-size: 1rem;
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    text-transform: uppercase;
}

.topbar-lang {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    text-decoration: none;
}
.topbar-lang:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

/* ============================================================
   SIDEBAR — Desktop
   ============================================================ */
.sidebar {
    position: fixed;
    left: -100%;
    top: 0;
    width: 85%;
    max-width: 300px;
    height: 100vh;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    z-index: var(--z-sidebar);
    transition: left var(--transition-normal);
    overflow-y: auto;
    padding: 0;
}
[dir="rtl"] .sidebar {
    left: auto;
    right: -100%;
    border-right: none;
    border-left: 1px solid var(--border-color);
    transition: right var(--transition-normal);
}

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

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-overlay);
    backdrop-filter: blur(4px);
}
.sidebar-overlay.active { display: block; }

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
}

.sidebar-brand {
    font-size: 1.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary-light), var(--accent-info));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav-section-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    padding: 16px 12px 8px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    font-size: 0.9rem;
    font-weight: 500;
}
.nav-link:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
}
.nav-link.active {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.2), rgba(108, 92, 231, 0.1));
    color: var(--accent-primary-light);
    font-weight: 600;
}
.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent-primary);
    border-radius: 0 4px 4px 0;
}
[dir="rtl"] .nav-link.active::before {
    left: auto;
    right: 0;
    border-radius: 4px 0 0 4px;
}
.nav-link {
    position: relative;
}
.nav-link i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}
.nav-link .nav-badge {
    margin-left: auto;
    background: var(--accent-danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    font-weight: 600;
}
[dir="rtl"] .nav-link .nav-badge {
    margin-left: 0;
    margin-right: auto;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-surface);
    border-radius: var(--radius-md);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
    color: white;
    flex-shrink: 0;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-info strong {
    display: block;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-info small {
    color: var(--text-muted);
    font-size: 0.7rem;
}

/* ============================================================
   BOTTOM NAVIGATION — Mobile Only
   ============================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: var(--bottomnav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: var(--z-bottomnav);
    padding: 0 8px;
    padding-bottom: env(safe-area-inset-bottom, 0);
    backdrop-filter: blur(12px);
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px 12px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    min-width: 56px;
    position: relative;
}
.bottom-nav-item:hover,
.bottom-nav-item.active {
    color: var(--accent-primary-light);
}
.bottom-nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 0 0 4px 4px;
}
.bottom-nav-item i {
    font-size: 1.2rem;
}
.bottom-nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
}
.bottom-nav-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-danger);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-card);
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    transition: all var(--transition-normal);
}
.card:hover {
    border-color: rgba(108, 92, 231, 0.3);
    box-shadow: var(--shadow-glow);
}
.card-glass {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(12px);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.card-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.kpi-card.kpi-expense::before { background: linear-gradient(90deg, var(--accent-danger), var(--accent-danger-light)); }
.kpi-card.kpi-revenue::before { background: linear-gradient(90deg, var(--accent-success), var(--accent-success-light)); }
.kpi-card.kpi-cashflow::before { background: linear-gradient(90deg, var(--accent-primary), var(--accent-primary-light)); }
.kpi-card.kpi-tasks::before { background: linear-gradient(90deg, var(--accent-warning), var(--accent-warning-dark)); }

.kpi-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 1rem;
}
.kpi-expense .kpi-icon { background: rgba(231, 76, 60, 0.15); color: var(--accent-danger); }
.kpi-revenue .kpi-icon { background: rgba(0, 184, 148, 0.15); color: var(--accent-success); }
.kpi-cashflow .kpi-icon { background: rgba(108, 92, 231, 0.15); color: var(--accent-primary-light); }
.kpi-tasks .kpi-icon { background: rgba(253, 203, 110, 0.15); color: var(--accent-warning); }

.kpi-value {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 4px;
    line-height: 1.2;
}
.kpi-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.kpi-trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 6px;
    padding: 3px 8px;
    border-radius: 20px;
}
.kpi-trend.up { background: rgba(0, 184, 148, 0.15); color: var(--accent-success); }
.kpi-trend.down { background: rgba(231, 76, 60, 0.15); color: var(--accent-danger); }

/* ============================================================
   TRANSACTION LIST (Mobile Cards)
   ============================================================ */
.transaction-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.transaction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
    cursor: pointer;
}
.transaction-item:hover {
    border-color: var(--border-color);
    transform: translateX(4px);
}
[dir="rtl"] .transaction-item:hover {
    transform: translateX(-4px);
}

.transaction-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}
.transaction-icon.expense { background: rgba(231, 76, 60, 0.15); color: var(--accent-danger); }
.transaction-icon.revenue { background: rgba(0, 184, 148, 0.15); color: var(--accent-success); }

.transaction-info {
    flex: 1;
    min-width: 0;
}
.transaction-title {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.transaction-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px;
}

.transaction-amount {
    font-weight: 700;
    font-size: 0.95rem;
    white-space: nowrap;
}
.transaction-amount.expense { color: var(--accent-danger); }
.transaction-amount.revenue { color: var(--accent-success); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 16px !important;
    transition: all var(--transition-fast);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.form-control:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
}
.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a0a0b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}
[dir="rtl"] select.form-control {
    background-position: left 16px center;
    padding-right: 16px;
    padding-left: 40px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.input-group {
    display: flex;
    gap: 0;
}
.input-group .form-control {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}
.input-group-text {
    padding: 14px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
}
[dir="rtl"] .input-group .form-control {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
[dir="rtl"] .input-group-text {
    border-left: 1px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    min-height: 48px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success), #00a381);
    color: white;
    box-shadow: 0 4px 15px rgba(0, 184, 148, 0.3);
}
.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 184, 148, 0.4);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-danger), #c0392b);
    color: white;
}
.btn-danger:hover {
    transform: translateY(-2px);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-color: var(--accent-primary);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    min-height: 36px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* FAB — Floating Action Button */
.fab {
    position: fixed;
    bottom: calc(var(--bottomnav-height) + 20px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-dark));
    color: white;
    border: none;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: var(--z-fab);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4);
    transition: all var(--transition-normal);
    animation: fab-pulse 3s infinite;
}
[dir="rtl"] .fab { right: auto; left: 20px; }
.fab:hover {
    transform: scale(1.1) translateY(-4px);
    box-shadow: 0 12px 35px rgba(108, 92, 231, 0.5);
}
@keyframes fab-pulse {
    0%, 100% { box-shadow: 0 8px 25px rgba(108, 92, 231, 0.4); }
    50% { box-shadow: 0 8px 35px rgba(108, 92, 231, 0.6); }
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: rgba(0, 184, 148, 0.15); color: var(--accent-success); }
.badge-danger { background: rgba(231, 76, 60, 0.15); color: var(--accent-danger); }
.badge-warning { background: rgba(253, 203, 110, 0.15); color: var(--accent-warning); }
.badge-info { background: rgba(116, 185, 255, 0.15); color: var(--accent-info); }
.badge-primary { background: rgba(108, 92, 231, 0.15); color: var(--accent-primary-light); }

.badge-danger-pulse {
    background: rgba(231, 76, 60, 0.15);
    color: var(--accent-danger);
    animation: badge-pulse 1.5s infinite;
}
@keyframes badge-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.badge-role {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: white;
}

/* ============================================================
   ALERTS / FLASH MESSAGES
   ============================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    animation: slideDown 0.3s ease;
}
.alert-success {
    background: rgba(0, 184, 148, 0.12);
    border: 1px solid rgba(0, 184, 148, 0.3);
    color: var(--accent-success);
}
.alert-danger {
    background: rgba(231, 76, 60, 0.12);
    border: 1px solid rgba(231, 76, 60, 0.3);
    color: var(--accent-danger);
}
.alert-warning {
    background: rgba(253, 203, 110, 0.12);
    border: 1px solid rgba(253, 203, 110, 0.3);
    color: var(--accent-warning);
}
.alert-info {
    background: rgba(116, 185, 255, 0.12);
    border: 1px solid rgba(116, 185, 255, 0.3);
    color: var(--accent-info);
}

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

/* ============================================================
   TABLES — Responsive
   ============================================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
}
.table th {
    background: var(--bg-surface);
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: left;
    white-space: nowrap;
}
[dir="rtl"] .table th { text-align: right; }

.table td {
    padding: 12px 16px;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-light);
    vertical-align: middle;
}
.table tbody tr {
    transition: background var(--transition-fast);
}
.table tbody tr:hover {
    background: var(--bg-surface);
}

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: var(--z-modal);
    backdrop-filter: blur(4px);
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    border: 1px solid var(--border-color);
    animation: slideUp 0.3s ease;
}
.modal-content .modal-handle {
    width: 40px;
    height: 4px;
    background: var(--text-muted);
    border-radius: 4px;
    margin: 0 auto 20px;
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    min-height: 38px;
}
.filter-chip:hover,
.filter-chip.active {
    background: rgba(108, 92, 231, 0.15);
    border-color: var(--accent-primary);
    color: var(--accent-primary-light);
}
.filter-chip .chip-count {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 6px;
    border-radius: 12px;
    font-size: 0.7rem;
}
.filter-chip.active .chip-count {
    background: rgba(108, 92, 231, 0.2);
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 1.3rem;
    font-weight: 700;
}
.page-title i {
    margin-right: 8px;
    color: var(--accent-primary-light);
}
[dir="rtl"] .page-title i {
    margin-right: 0;
    margin-left: 8px;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}
.empty-state i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 16px;
}
.empty-state p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================================
   CHART CONTAINER
   ============================================================ */
.chart-container {
    position: relative;
    width: 100%;
    height: 250px;
    margin: 16px 0;
}

/* ============================================================
   ATTENDANCE BUTTON
   ============================================================ */
.attendance-btn {
    width: 100%;
    max-width: 280px;
    height: 140px;
    border-radius: var(--radius-xl);
    border: 3px dashed;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-normal);
    margin: 20px auto;
    background: transparent;
    color: white;
}
.attendance-btn.check-in {
    border-color: var(--accent-success);
    color: var(--accent-success);
}
.attendance-btn.check-in:hover {
    background: rgba(0, 184, 148, 0.1);
    transform: scale(1.05);
}
.attendance-btn.check-out {
    border-color: var(--accent-danger);
    color: var(--accent-danger);
}
.attendance-btn.check-out:hover {
    background: rgba(231, 76, 60, 0.1);
    transform: scale(1.05);
}
.attendance-btn i {
    font-size: 2.5rem;
}

/* ============================================================
   KANBAN BOARD (Tasks)
   ============================================================ */
.kanban-board {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.kanban-column {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
}
.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}
.kanban-column-title {
    font-size: 0.85rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.kanban-count {
    background: var(--bg-surface);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.kanban-card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
    border: 1px solid var(--border-light);
    transition: all var(--transition-fast);
}
.kanban-card:hover {
    border-color: var(--border-color);
    transform: translateY(-2px);
}
.kanban-card-title {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 8px;
}
.kanban-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ============================================================
   CATEGORY GRID
   ============================================================ */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}
.category-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 16px;
    text-align: center;
    transition: all var(--transition-fast);
    cursor: pointer;
}
.category-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}
.category-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 10px;
    font-size: 1.2rem;
}
.category-name {
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 4px;
}
.category-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 4px;
    overflow-x: auto;
}
.tab {
    flex: 1;
    padding: 10px 16px;
    text-align: center;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
}
.tab:hover { color: var(--text-primary); }
.tab.active {
    background: var(--accent-primary);
    color: white;
    font-weight: 600;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg-dark);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(ellipse at 30% 50%, rgba(108, 92, 231, 0.08) 0%, transparent 60%),
                radial-gradient(ellipse at 70% 80%, rgba(0, 184, 148, 0.06) 0%, transparent 50%);
    animation: bgFloat 20s ease-in-out infinite;
}
@keyframes bgFloat {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(-20px, 20px); }
    66% { transform: translate(20px, -10px); }
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 36px 28px;
    width: 100%;
    max-width: 400px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-info));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin: 0 auto 20px;
    animation: logoFloat 4s ease-in-out infinite;
}
@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 30px;
}

/* ============================================================
   LOADING / SPINNER
   ============================================================ */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--accent-success) !important; }
.text-danger { color: var(--accent-danger) !important; }
.text-warning { color: var(--accent-warning) !important; }
.text-info { color: var(--accent-info) !important; }
.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

.section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-surface); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   DESKTOP BREAKPOINTS
   ============================================================ */

/* Tablet */
@media (min-width: 768px) {
    .main-content {
        padding: 24px;
        padding-bottom: calc(var(--bottomnav-height) + 32px);
    }

    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    .kpi-value { font-size: 1.5rem; }

    .chart-container { height: 300px; }

    .category-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .kanban-board {
        flex-direction: row;
    }
    .kanban-column {
        flex: 1;
        min-width: 250px;
    }

    .modal-content {
        border-radius: var(--radius-xl);
        max-width: 500px;
        margin: auto;
    }
    .modal-overlay {
        align-items: center;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .bottom-nav { display: none; }
    .topbar-hamburger { display: none; }

    .sidebar {
        position: fixed;
        left: 0;
        width: var(--sidebar-width);
        border-radius: 0;
    }
    [dir="rtl"] .sidebar {
        left: auto;
        right: 0;
    }

    .main-content {
        margin-left: var(--sidebar-width);
        padding: 28px 32px;
        padding-bottom: 40px;
    }
    [dir="rtl"] .main-content {
        margin-left: 0;
        margin-right: var(--sidebar-width);
    }

    .fab {
        bottom: 30px;
        right: 30px;
    }
    [dir="rtl"] .fab {
        right: auto;
        left: 30px;
    }

    .category-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .chart-container { height: 350px; }
}

/* Large Desktop */
@media (min-width: 1200px) {
    .main-content {
        max-width: calc(100% - var(--sidebar-width));
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .sidebar, .bottom-nav, .topbar, .fab, .btn, .filter-bar { display: none !important; }
    .main-content { margin: 0; padding: 20px; }
    body { background: white; color: #333; }
    .card { border: 1px solid #ddd; box-shadow: none; background: white; }
    .kpi-value { color: #333; }
}
