@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
    :root {
        --primary-50: #eef2ff;
        --primary-100: #e0e7ff;
        --primary-200: #c7d2fe;
        --primary-300: #a5b4fc;
        --primary-400: #818cf8;
        --primary-500: #6366f1;
        --primary-600: #4f46e5;
        --primary-700: #4338ca;
        --primary-800: #2d2d5e;
        --primary-900: #1a1a2e;
        --accent-400: #fbbf24;
        --accent-500: #f59e0b;
        --surface: #faf9f6;
        --card-bg: #ffffff;
        --card-border: #e5e7eb;
        --text-primary: #111827;
        --text-secondary: #6b7280;
        --text-muted: #9ca3af;
        --input-bg: #ffffff;
        --input-border: #d1d5db;
        --table-row-alt: rgba(0, 0, 0, 0.01);
        --table-row-hover: rgba(79, 70, 229, 0.03);
    }

    .dark {
        --surface: #0f0f1a;
        --primary-800: #1e1e3a;
        --primary-900: #0d0d1a;
        --card-bg: #1a1a2e;
        --card-border: #2d2d45;
        --text-primary: #e2e8f0;
        --text-secondary: #94a3b8;
        --text-muted: #64748b;
        --input-bg: #1a1a2e;
        --input-border: #2d2d45;
        --table-row-alt: rgba(255, 255, 255, 0.02);
        --table-row-hover: rgba(99, 102, 241, 0.08);
    }

    [x-cloak] {
        display: none !important;
    }

    html {
        scroll-behavior: smooth;
    }

    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        background-color: var(--surface);
        color: var(--text-primary);
        transition: background-color 0.3s ease, color 0.3s ease;
    }

    ::selection {
        background-color: var(--primary-500);
        color: white;
    }

    html {
        transition: background-color 0.3s ease;
    }
}

@layer components {
    /* ===== Glass ===== */
    .glass {
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }
    .dark .glass {
        background: rgba(26, 26, 46, 0.85);
    }

    .glass-dark {
        background: rgba(26, 26, 46, 0.85);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    /* ===== Gradients ===== */
    .gradient-primary {
        background: linear-gradient(135deg, #4f46e5, #7c3aed);
    }
    .gradient-accent {
        background: linear-gradient(135deg, #f59e0b, #fbbf24);
    }
    .gradient-navy {
        background: linear-gradient(180deg, #1a1a2e 0%, #2d2d5e 100%);
    }
    .gradient-card-1 {
        background: linear-gradient(135deg, #4f46e5, #6366f1);
    }
    .gradient-card-2 {
        background: linear-gradient(135deg, #059669, #10b981);
    }
    .gradient-card-3 {
        background: linear-gradient(135deg, #d97706, #f59e0b);
    }
    .gradient-card-4 {
        background: linear-gradient(135deg, #dc2626, #ef4444);
    }
    .gradient-card-5 {
        background: linear-gradient(135deg, #7c3aed, #8b5cf6);
    }
    .gradient-card-6 {
        background: linear-gradient(135deg, #0891b2, #06b6d4);
    }
    .gradient-card-7 {
        background: linear-gradient(135deg, #be123c, #e11d48);
    }

    .gradient-animated {
        background: linear-gradient(-45deg, #4f46e5, #7c3aed, #6366f1, #4f46e5);
        background-size: 400% 400%;
        animation: gradientShift 4s ease infinite;
    }

    /* ===== Card Styles ===== */
    .card-hover {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    .card-hover:hover {
        transform: translateY(-3px);
        box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
    }

    .card-elevated {
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.08), 0 1px 4px -1px rgba(0, 0, 0, 0.04);
        transition: all 0.3s ease;
    }
    .card-elevated:hover {
        box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.12), 0 4px 8px -2px rgba(0, 0, 0, 0.06);
    }

    .card-glow {
        box-shadow: 0 0 20px rgba(79, 70, 229, 0.15);
    }
    .dark .card-glow {
        box-shadow: 0 0 30px rgba(79, 70, 229, 0.1);
    }

    /* ===== Alert Cards ===== */
    .alert-card {
        border-left: 4px solid;
        transition: all 0.3s ease;
        background: var(--card-bg);
    }
    .alert-card:hover {
        transform: translateX(4px);
    }
    .alert-card-danger {
        border-left-color: #dc2626;
        background: linear-gradient(to right, #fef2f2, var(--card-bg));
    }
    .dark .alert-card-danger {
        background: linear-gradient(to right, rgba(220, 38, 38, 0.1), var(--card-bg));
    }
    .alert-card-warning {
        border-left-color: #f59e0b;
        background: linear-gradient(to right, #fffbeb, var(--card-bg));
    }
    .dark .alert-card-warning {
        background: linear-gradient(to right, rgba(245, 158, 11, 0.1), var(--card-bg));
    }
    .alert-card-success {
        border-left-color: #059669;
        background: linear-gradient(to right, #ecfdf5, var(--card-bg));
    }
    .dark .alert-card-success {
        background: linear-gradient(to right, rgba(5, 150, 105, 0.1), var(--card-bg));
    }

    /* ===== Tables ===== */
    .table-container {
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.06);
    }

    .table-header-sticky {
        position: sticky;
        top: 0;
        z-index: 10;
    }

    .table-th {
        padding: 16px 24px;
        text-align: left;
        font-size: 11px;
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        letter-spacing: 0.05em;
        background: rgba(249, 250, 251, 0.8);
        backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--card-border);
    }
    .dark .table-th {
        background: rgba(26, 26, 46, 0.8);
    }

    .table-td {
        padding: 16px 24px;
        white-space: nowrap;
        font-size: 13px;
        color: var(--text-primary);
    }

    .table-row {
        transition: all 0.2s ease;
        border-bottom: 1px solid var(--card-border);
    }
    .table-row:last-child {
        border-bottom: none;
    }
    .table-row:hover {
        background: var(--table-row-hover);
    }
    .table-row:nth-child(even) {
        background: var(--table-row-alt);
    }
    .table-row:nth-child(even):hover {
        background: var(--table-row-hover);
    }

    .table-th-sortable {
        cursor: pointer;
        user-select: none;
    }
    .table-th-sortable:hover {
        color: var(--primary-600);
    }

    /* ===== Badges ===== */
    .badge {
        display: inline-flex;
        align-items: center;
        padding: 2px 10px;
        border-radius: 9999px;
        font-size: 12px;
        font-weight: 500;
    }
    .badge-success {
        background: rgba(5, 150, 105, 0.08);
        color: #059669;
        ring: 1px solid rgba(5, 150, 105, 0.2);
    }
    .badge-danger {
        background: rgba(220, 38, 38, 0.08);
        color: #dc2626;
        ring: 1px solid rgba(220, 38, 38, 0.2);
    }
    .badge-warning {
        background: rgba(245, 158, 11, 0.08);
        color: #d97706;
        ring: 1px solid rgba(245, 158, 11, 0.2);
    }
    .badge-info {
        background: rgba(6, 182, 212, 0.08);
        color: #0891b2;
        ring: 1px solid rgba(6, 182, 212, 0.2);
    }
    .badge-purple {
        background: rgba(139, 92, 246, 0.08);
        color: #7c3aed;
        ring: 1px solid rgba(139, 92, 246, 0.2);
    }
    .badge-indigo {
        background: rgba(99, 102, 241, 0.08);
        color: #4f46e5;
        ring: 1px solid rgba(99, 102, 241, 0.2);
    }
    .badge-gray {
        background: rgba(107, 114, 128, 0.08);
        color: #6b7280;
        ring: 1px solid rgba(107, 114, 128, 0.2);
    }

    /* ===== Buttons ===== */
    .btn-primary {
        display: inline-flex;
        align-items: center;
        padding: 10px 20px;
        font-size: 14px;
        font-weight: 500;
        color: white;
        border-radius: 12px;
        transition: all 0.2s ease;
        background: linear-gradient(135deg, #4f46e5, #6366f1);
        box-shadow: 0 2px 8px -2px rgba(79, 70, 229, 0.4);
    }
    .btn-primary:hover {
        background: linear-gradient(135deg, #4338ca, #4f46e5);
        box-shadow: 0 4px 14px -2px rgba(79, 70, 229, 0.5);
        transform: translateY(-1px);
    }
    .btn-primary:active {
        transform: translateY(0);
    }
    .btn-primary:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        transform: none;
    }

    .btn-secondary {
        display: inline-flex;
        align-items: center;
        padding: 10px 20px;
        font-size: 14px;
        font-weight: 500;
        color: var(--text-primary);
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 12px;
        transition: all 0.2s ease;
    }
    .btn-secondary:hover {
        border-color: #d1d5db;
        transform: translateY(-1px);
        box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.08);
    }
    .dark .btn-secondary:hover {
        border-color: #4f46e5;
        box-shadow: 0 2px 8px -2px rgba(79, 70, 229, 0.2);
    }

    .btn-danger {
        display: inline-flex;
        align-items: center;
        padding: 10px 20px;
        font-size: 14px;
        font-weight: 500;
        color: white;
        border-radius: 12px;
        transition: all 0.2s ease;
        background: linear-gradient(135deg, #dc2626, #ef4444);
        box-shadow: 0 2px 8px -2px rgba(220, 38, 38, 0.4);
    }
    .btn-danger:hover {
        background: linear-gradient(135deg, #b91c1c, #dc2626);
        box-shadow: 0 4px 14px -2px rgba(220, 38, 38, 0.5);
        transform: translateY(-1px);
    }

    .btn-ghost {
        display: inline-flex;
        align-items: center;
        padding: 10px 20px;
        font-size: 14px;
        font-weight: 500;
        color: var(--text-secondary);
        border-radius: 12px;
        transition: all 0.2s ease;
    }
    .btn-ghost:hover {
        background: rgba(0, 0, 0, 0.05);
        color: var(--text-primary);
    }
    .dark .btn-ghost:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .btn-sm {
        padding: 6px 12px;
        font-size: 12px;
        border-radius: 8px;
    }
    .btn-lg {
        padding: 14px 28px;
        font-size: 16px;
        border-radius: 14px;
    }

    .btn-loading {
        position: relative;
        color: transparent !important;
        pointer-events: none;
    }
    .btn-loading::after {
        content: '';
        position: absolute;
        width: 18px;
        height: 18px;
        top: 50%;
        left: 50%;
        margin-left: -9px;
        margin-top: -9px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top-color: white;
        border-radius: 50%;
        animation: spin 0.6s linear infinite;
    }

    /* ===== Ripple Effect ===== */
    .ripple-container {
        position: relative;
        overflow: hidden;
    }
    .ripple-effect {
        position: absolute;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: scale(0);
        animation: ripple 0.6s ease-out;
        pointer-events: none;
    }

    /* ===== Form Elements ===== */
    .form-input {
        display: block;
        width: 100%;
        border-radius: 12px;
        border: 1px solid var(--input-border);
        background: var(--input-bg);
        color: var(--text-primary);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
        transition: all 0.2s ease;
        font-size: 14px;
        padding: 10px 14px;
    }
    .form-input:hover {
        border-color: #9ca3af;
    }
    .form-input:focus {
        border-color: var(--primary-500);
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
        outline: none;
    }
    .dark .form-input:focus {
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
    }
    .form-input::placeholder {
        color: var(--text-muted);
    }

    .form-input-error {
        border-color: #f87171 !important;
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.08) !important;
    }

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

    .form-select {
        display: block;
        width: 100%;
        border-radius: 12px;
        border: 1px solid var(--input-border);
        background: var(--input-bg);
        color: var(--text-primary);
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
        transition: all 0.2s ease;
        font-size: 14px;
        padding: 10px 14px;
        appearance: none;
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
        background-position: right 8px center;
        background-repeat: no-repeat;
        background-size: 20px;
        padding-right: 36px;
    }
    .form-select:focus {
        border-color: var(--primary-500);
        box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.08);
        outline: none;
    }

    /* ===== Search Card ===== */
    .search-card {
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 16px;
        padding: 20px;
        margin-bottom: 24px;
        box-shadow: 0 4px 16px -4px rgba(0, 0, 0, 0.04);
    }

    /* ===== Page Header ===== */
    .page-header {
        margin-bottom: 24px;
    }
    .page-title {
        font-size: 24px;
        font-weight: 700;
        color: var(--text-primary);
        letter-spacing: -0.02em;
    }
    .page-subtitle {
        margin-top: 4px;
        font-size: 14px;
        color: var(--text-secondary);
    }

    /* ===== Divider ===== */
    .divider {
        border-top: 1px solid var(--card-border);
        margin: 24px 0;
    }

    /* ===== Section Title ===== */
    .section-title {
        font-size: 15px;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 16px;
        padding-bottom: 8px;
        border-bottom: 1px solid var(--card-border);
    }

    /* ===== Sidebar ===== */
    .sidebar-nav-item {
        display: flex;
        align-items: center;
        padding: 10px 16px;
        font-size: 13px;
        font-weight: 500;
        border-radius: 12px;
        transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
        overflow: hidden;
    }
    .sidebar-nav-item-active {
        color: white;
        background: linear-gradient(135deg, #4f46e5, #6366f1);
        box-shadow: 0 4px 20px -4px rgba(79, 70, 229, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    }
    .sidebar-nav-item-inactive {
        color: rgba(255, 255, 255, 0.6);
    }
    .sidebar-nav-item-inactive:hover {
        color: white;
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(3px);
    }

    .sidebar-section-label {
        padding: 8px 16px 4px;
        font-size: 10px;
        font-weight: 700;
        color: rgba(255, 255, 255, 0.3);
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

    .sidebar-section-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 10px 16px;
        font-size: 13px;
        font-weight: 500;
        color: rgba(255, 255, 255, 0.6);
        border-radius: 12px;
        transition: all 0.2s ease;
        cursor: pointer;
        background: none;
        border: none;
        text-align: left;
    }
    .sidebar-section-btn:hover {
        color: white;
        background: rgba(255, 255, 255, 0.08);
    }
    .sidebar-section-btn.active {
        color: white;
        background: linear-gradient(135deg, #4f46e5, #6366f1);
        box-shadow: 0 4px 12px -2px rgba(79, 70, 229, 0.4);
    }

    .sidebar-sub-item {
        display: flex;
        align-items: center;
        padding: 8px 12px;
        font-size: 13px;
        font-weight: 400;
        border-radius: 10px;
        transition: all 0.2s ease;
        color: rgba(255, 255, 255, 0.5);
    }
    .sidebar-sub-item:hover {
        color: white;
        background: rgba(255, 255, 255, 0.06);
    }
    .sidebar-sub-item.active {
        color: white;
        background: rgba(99, 102, 241, 0.3);
    }

    /* ===== Stat Card ===== */
    .stat-card {
        position: relative;
        overflow: hidden;
        border-radius: 16px;
        padding: 24px;
        transition: all 0.3s ease;
    }
    .stat-card::before {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        width: 40%;
        height: 100%;
        background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.08));
        pointer-events: none;
    }

    /* ===== Toast ===== */
    .toast-container {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        gap: 10px;
        pointer-events: none;
    }
    .toast {
        pointer-events: auto;
        display: flex;
        align-items: flex-start;
        gap: 12px;
        padding: 16px;
        border-radius: 14px;
        min-width: 320px;
        max-width: 420px;
        box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.2), 0 4px 12px -4px rgba(0, 0, 0, 0.1);
        animation: slideInRight 0.35s ease-out;
        position: relative;
        overflow: hidden;
    }
    .toast-removing {
        animation: slideOutRight 0.3s ease-in forwards;
    }
    .toast-success {
        background: linear-gradient(135deg, #059669, #10b981);
        color: white;
    }
    .toast-error {
        background: linear-gradient(135deg, #dc2626, #ef4444);
        color: white;
    }
    .toast-warning {
        background: linear-gradient(135deg, #d97706, #f59e0b);
        color: white;
    }
    .toast-info {
        background: linear-gradient(135deg, #0891b2, #06b6d4);
        color: white;
    }
    .toast-icon {
        flex-shrink: 0;
        width: 22px;
        height: 22px;
        margin-top: 1px;
    }
    .toast-content {
        flex: 1;
        min-width: 0;
    }
    .toast-title {
        font-size: 13px;
        font-weight: 600;
    }
    .toast-message {
        font-size: 12px;
        opacity: 0.9;
        margin-top: 2px;
    }
    .toast-close {
        flex-shrink: 0;
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
        opacity: 0.7;
        transition: opacity 0.2s;
        cursor: pointer;
    }
    .toast-close:hover {
        opacity: 1;
        background: rgba(0, 0, 0, 0.1);
    }
    .toast-progress {
        position: absolute;
        bottom: 0;
        left: 0;
        height: 3px;
        background: rgba(255, 255, 255, 0.4);
        animation: progressShrink 4s linear forwards;
        border-radius: 0 2px 2px 0;
    }

    /* ===== Confirm Dialog ===== */
    .confirm-overlay {
        position: fixed;
        inset: 0;
        z-index: 9998;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(8px);
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 16px;
        animation: fadeIn 0.2s ease-out;
    }
    .confirm-dialog {
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 20px;
        padding: 28px;
        max-width: 420px;
        width: 100%;
        box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.3);
        animation: bounceIn 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    }
    .confirm-icon {
        width: 48px;
        height: 48px;
        border-radius: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 16px;
        font-size: 22px;
    }
    .confirm-icon-danger {
        background: rgba(220, 38, 38, 0.1);
        color: #dc2626;
    }
    .confirm-icon-warning {
        background: rgba(245, 158, 11, 0.1);
        color: #d97706;
    }
    .confirm-icon-info {
        background: rgba(99, 102, 241, 0.1);
        color: #4f46e5;
    }
    .confirm-title {
        font-size: 17px;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 6px;
    }
    .confirm-message {
        font-size: 14px;
        color: var(--text-secondary);
        line-height: 1.5;
        margin-bottom: 24px;
    }
    .confirm-actions {
        display: flex;
        gap: 10px;
        justify-content: flex-end;
    }

    /* ===== Dropdown Menu ===== */
    .dropdown-container {
        position: relative;
        display: inline-block;
    }
    .dropdown-trigger {
        cursor: pointer;
    }
    .dropdown-menu {
        position: absolute;
        z-index: 50;
        min-width: 180px;
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 12px;
        box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.15), 0 4px 12px -4px rgba(0, 0, 0, 0.06);
        padding: 6px;
        animation: scaleIn 0.15s ease-out;
        transform-origin: top right;
    }
    .dropdown-menu-left {
        right: 0;
        top: calc(100% + 4px);
        transform-origin: top right;
    }
    .dropdown-menu-right {
        left: 0;
        top: calc(100% + 4px);
        transform-origin: top left;
    }
    .dropdown-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 9px 12px;
        font-size: 13px;
        font-weight: 500;
        color: var(--text-primary);
        border-radius: 8px;
        transition: all 0.15s ease;
        cursor: pointer;
        width: 100%;
        text-align: left;
        border: none;
        background: none;
    }
    .dropdown-item:hover {
        background: var(--table-row-hover);
        color: var(--primary-600);
    }
    .dropdown-item-danger {
        color: #dc2626;
    }
    .dropdown-item-danger:hover {
        background: rgba(220, 38, 38, 0.08);
        color: #dc2626;
    }
    .dropdown-divider {
        height: 1px;
        background: var(--card-border);
        margin: 4px 0;
    }

    /* ===== Skeleton ===== */
    .skeleton {
        background: linear-gradient(
            90deg,
            var(--card-border) 25%,
            rgba(255, 255, 255, 0.15) 50%,
            var(--card-border) 75%
        );
        background-size: 200% 100%;
        animation: shimmer 2s infinite linear;
        border-radius: 8px;
    }
    .dark .skeleton {
        background: linear-gradient(
            90deg,
            #2d2d45 25%,
            rgba(255, 255, 255, 0.05) 50%,
            #2d2d45 75%
        );
        background-size: 200% 100%;
    }
    .skeleton-text {
        height: 14px;
        width: 100%;
        margin-bottom: 8px;
    }
    .skeleton-text-sm {
        height: 10px;
        width: 60%;
        margin-bottom: 6px;
    }
    .skeleton-avatar {
        width: 40px;
        height: 40px;
        border-radius: 9999px;
    }
    .skeleton-card {
        height: 120px;
        border-radius: 16px;
    }
    .skeleton-table-row {
        height: 52px;
        width: 100%;
        margin-bottom: 4px;
        border-radius: 4px;
    }
    .skeleton-stat {
        height: 100px;
        border-radius: 16px;
    }

    /* ===== Notification Bell ===== */
    .notification-badge {
        position: absolute;
        top: -2px;
        right: -2px;
        width: 18px;
        height: 18px;
        border-radius: 9999px;
        background: #dc2626;
        color: white;
        font-size: 10px;
        font-weight: 700;
        display: flex;
        align-items: center;
        justify-content: center;
        border: 2px solid var(--card-bg);
        animation: pulseGlow 2s ease-in-out infinite;
    }

    /* ===== Search Modal ===== */
.search-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 16px;
    animation: fadeIn 0.15s ease-out;
}
.search-modal {
    width: 100%;
    max-width: 640px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.2s ease-out;
}
.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
}
.search-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 16px;
    background: transparent;
    color: var(--text-primary);
}
.search-input-wrapper input::placeholder {
    color: var(--text-muted);
}
.search-results {
    max-height: 360px;
    overflow-y: auto;
    padding: 8px;
}
.search-section-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    transition: all 0.15s ease;
    cursor: pointer;
    color: var(--text-primary);
}
.search-result-item:hover,
.search-result-item.active {
    background: var(--table-row-hover);
}
.search-result-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-500);
}
.search-result-icon.blue { background: rgba(6, 182, 212, 0.1); color: #0891b2; }
.search-result-icon.green { background: rgba(5, 150, 105, 0.1); color: #059669; }
.search-result-icon.orange { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.search-result-icon.purple { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }
.search-result-info { flex: 1; min-width: 0; }
.search-result-title { font-size: 14px; font-weight: 500; }
.search-result-subtitle { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.search-shortcut {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
}
.search-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--surface);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    width: 240px;
    cursor: text;
}
.search-trigger:hover {
    border-color: var(--primary-400);
    background: var(--card-bg);
}
@media (max-width: 1024px) {
    .search-trigger { width: 160px; }
    .search-trigger span { display: none; }
}
@media (max-width: 640px) {
    .search-trigger { width: 40px; padding: 8px; justify-content: center; }
    .search-trigger span, .search-trigger kbd { display: none; }
}

/* ===== Language Selector ===== */
.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.15s ease;
    cursor: pointer;
    white-space: nowrap;
}
.lang-option:hover {
    background: var(--table-row-hover);
    color: var(--primary-600);
}
.lang-option.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-600);
}
.lang-flag {
    width: 20px;
    height: 14px;
    border-radius: 3px;
    object-fit: cover;
    flex-shrink: 0;
}

/* ===== User Dropdown ===== */
.user-dropdown-header {
    padding: 16px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 12px;
}
.user-dropdown-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}
.user-dropdown-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.user-dropdown-email {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Fullscreen Button ===== */
.fullscreen-btn {
    position: relative;
}

/* ===== Header enhancements ===== */
.header-icon-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: var(--text-muted);
    transition: all 0.2s ease;
    background: transparent;
}
.header-icon-btn:hover {
    background: var(--table-row-hover);
    color: var(--text-primary);
}

/* ===== File Upload ===== */
    .file-upload-zone {
        border: 2px dashed var(--card-border);
        border-radius: 14px;
        padding: 32px;
        text-align: center;
        cursor: pointer;
        transition: all 0.2s ease;
        background: var(--surface);
    }
    .file-upload-zone:hover,
    .file-upload-zone.dragover {
        border-color: var(--primary-500);
        background: rgba(99, 102, 241, 0.03);
    }
    .dark .file-upload-zone:hover,
    .dark .file-upload-zone.dragover {
        background: rgba(99, 102, 241, 0.06);
    }
    .file-upload-preview {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin-top: 12px;
        padding: 8px 14px;
        background: var(--card-bg);
        border: 1px solid var(--card-border);
        border-radius: 10px;
        font-size: 13px;
    }
    .file-upload-preview img {
        width: 36px;
        height: 36px;
        border-radius: 6px;
        object-fit: cover;
    }

    /* ===== Glow Effects ===== */
    .glow-primary {
        animation: pulseGlow 3s ease-in-out infinite;
        box-shadow: 0 0 16px rgba(79, 70, 229, 0.3);
    }
    .glow-accent {
        animation: pulseGlow 3s ease-in-out infinite;
        box-shadow: 0 0 16px rgba(245, 158, 11, 0.3);
    }

    /* ===== Shimmer Overlay ===== */
    .shimmer-overlay {
        position: relative;
        overflow: hidden;
    }
    .shimmer-overlay::after {
        content: '';
        position: absolute;
        inset: 0;
        background: linear-gradient(
            90deg,
            transparent 0%,
            rgba(255, 255, 255, 0.08) 50%,
            transparent 100%
        );
        background-size: 200% 100%;
        animation: shimmer 2s infinite linear;
        pointer-events: none;
    }
}

@layer utilities {
    /* ===== Animation Utilities ===== */
    .animate-float {
        animation: float 3s ease-in-out infinite;
    }
    .animate-slide-up {
        animation: slideUp 0.4s ease-out;
    }
    .animate-slide-down {
        animation: slideDown 0.3s ease-out;
    }
    .animate-fade-in {
        animation: fadeIn 0.3s ease-out;
    }
    .animate-scale-in {
        animation: scaleIn 0.2s ease-out;
    }
    .animate-count-up {
        animation: countUp 0.6s ease-out;
    }
    .animate-shake {
        animation: shake 0.4s ease-in-out;
    }
    .animate-pulse-soft {
        animation: pulseSoft 2s ease-in-out infinite;
    }
    .animate-stagger-1 { animation-delay: 0.05s; }
    .animate-stagger-2 { animation-delay: 0.1s; }
    .animate-stagger-3 { animation-delay: 0.15s; }
    .animate-stagger-4 { animation-delay: 0.2s; }
    .animate-stagger-5 { animation-delay: 0.25s; }
    .animate-stagger-6 { animation-delay: 0.3s; }
    .animate-stagger-7 { animation-delay: 0.35s; }
    .animate-stagger-8 { animation-delay: 0.4s; }
    .animate-stagger-9 { animation-delay: 0.45s; }
    .animate-stagger-10 { animation-delay: 0.5s; }

    /* ===== Text Gradients ===== */
    .text-gradient {
        background: linear-gradient(135deg, #4f46e5, #7c3aed);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }
    .text-gradient-gold {
        background: linear-gradient(135deg, #f59e0b, #fbbf24);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
        background-clip: text;
    }

    /* ===== Scrollbar ===== */
    .sidebar-scrollbar::-webkit-scrollbar {
        width: 4px;
    }
    .sidebar-scrollbar::-webkit-scrollbar-track {
        background: transparent;
    }
    .sidebar-scrollbar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.15);
        border-radius: 4px;
    }
    .sidebar-scrollbar::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .scrollbar-thin::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    .scrollbar-thin::-webkit-scrollbar-track {
        background: transparent;
    }
    .scrollbar-thin::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 3px;
    }
    .scrollbar-thin::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.2);
    }
    .dark .scrollbar-thin::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
    }
    .dark .scrollbar-thin::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.2);
    }
}

/* ===== Keyframes ===== */
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

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

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

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

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

@keyframes pulseSoft {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

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

@keyframes pulseGlow {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes slideInRight {
    0% { transform: translateX(100%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(100%); opacity: 0; }
}

@keyframes bounceIn {
    0% { transform: scale(0.9); opacity: 0; }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); opacity: 1; }
}

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

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 0.5; }
    100% { transform: scale(4); opacity: 0; }
}

@keyframes progressShrink {
    0% { width: 100%; }
    100% { width: 0%; }
}

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

/* ===== Sidebar Enhancements ===== */
.sidebar-shine::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.025) 50%,
        transparent 100%
    );
    animation: shineSweep 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

.sidebar-deco {
    position: absolute;
    pointer-events: none;
    color: rgba(255, 255, 255, 0.06);
    z-index: 0;
    line-height: 1;
}

.sidebar-deco-1 {
    top: 12%;
    right: -8%;
    font-size: 110px;
    opacity: 0.5;
    animation: sidebarFloat 7s ease-in-out infinite;
}

.sidebar-deco-2 {
    bottom: 20%;
    left: -6%;
    width: 100px;
    height: 80px;
    opacity: 0.4;
    animation: sidebarFloat 9s ease-in-out infinite 1s;
}

.sidebar-deco-3 {
    top: 45%;
    right: 2%;
    width: 55px;
    height: 55px;
    opacity: 0.35;
    animation: sidebarFloat 8s ease-in-out infinite 3s;
}

.sidebar-nav-item .nav-icon {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav-item:hover .nav-icon {
    transform: scale(1.12) translateX(2px);
}

.sidebar-nav-item-active .nav-icon {
    opacity: 1 !important;
}

/* Entrance animations */
.sidebar-entrance {
    animation: sidebarSlideIn 0.45s ease-out both;
}

.sidebar-entrance-1 { animation-delay: 0.03s; }
.sidebar-entrance-2 { animation-delay: 0.08s; }
.sidebar-entrance-3 { animation-delay: 0.13s; }
.sidebar-entrance-4 { animation-delay: 0.18s; }
.sidebar-entrance-5 { animation-delay: 0.23s; }
.sidebar-entrance-6 { animation-delay: 0.28s; }
.sidebar-entrance-7 { animation-delay: 0.33s; }
.sidebar-entrance-8 { animation-delay: 0.38s; }
.sidebar-entrance-9 { animation-delay: 0.43s; }
.sidebar-entrance-10 { animation-delay: 0.48s; }

/* User card enhancement */
.user-card {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.user-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    padding: 1px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed, #6366f1, #4f46e5);
    background-size: 300% 300%;
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: gradientShift 4s ease infinite;
    pointer-events: none;
}

.user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px -8px rgba(79, 70, 229, 0.3);
}

/* ===== Sidebar Additional Keyframes ===== */
@keyframes sidebarFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(0.8deg); }
    75% { transform: translateY(5px) rotate(-0.5deg); }
}

@keyframes sidebarSlideIn {
    from { opacity: 0; transform: translateX(-18px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes shineSweep {
    0% { transform: translateX(0); }
    50% { transform: translateX(100%); }
    100% { transform: translateX(200%); }
}
