/* ============================================
   OPTIMA FINANCE - Modern UI 2026
   ============================================ */

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

/* ============ CSS Variables ============ */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #0f172a;
    --bg-card: rgba(15, 23, 42, 0.8);
    --bg-glass: rgba(30, 41, 59, 0.5);
    --bg-sidebar: rgba(10, 14, 26, 0.95);
    --bg-input: rgba(30, 41, 59, 0.6);
    --bg-hover: rgba(59, 130, 246, 0.1);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --accent-blue: #3b82f6;
    --accent-teal: #14b8a6;
    --accent-purple: #8b5cf6;
    --accent-pink: #ec4899;
    --accent-orange: #f97316;
    --accent-yellow: #f59e0b;
    --accent-green: #22c55e;
    --accent-red: #ef4444;
    --accent-cyan: #06b6d4;

    --gradient-blue: linear-gradient(135deg, #3b82f6, #1d4ed8);
    --gradient-teal: linear-gradient(135deg, #14b8a6, #0d9488);
    --gradient-purple: linear-gradient(135deg, #8b5cf6, #7c3aed);
    --gradient-pink: linear-gradient(135deg, #ec4899, #db2777);
    --gradient-orange: linear-gradient(135deg, #f97316, #ea580c);

    --border-color: rgba(148, 163, 184, 0.1);
    --border-light: rgba(148, 163, 184, 0.15);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);
    --shadow-glow-teal: 0 0 20px rgba(20, 184, 166, 0.3);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --sidebar-width: 280px;
    --sidebar-collapsed: 80px;
    --header-height: 70px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* ============ LIGHT THEME ============ */
[data-theme="light"] {
    --bg-primary: #f1f5f9;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-glass: rgba(241, 245, 249, 0.7);
    --bg-sidebar: rgba(255, 255, 255, 0.97);
    --bg-input: rgba(241, 245, 249, 0.8);
    --bg-hover: rgba(59, 130, 246, 0.06);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --border-color: rgba(15, 23, 42, 0.08);
    --border-light: rgba(15, 23, 42, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.1);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.15);
    --shadow-glow-teal: 0 0 20px rgba(20, 184, 166, 0.15);
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(20, 184, 166, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
}

[data-theme="light"] .login-card {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .login-logo h1 {
    -webkit-text-fill-color: transparent;
}

[data-theme="light"] .top-header {
    background: rgba(255, 255, 255, 0.8);
}

[data-theme="light"] .data-table th {
    background: rgba(241, 245, 249, 0.8);
}

[data-theme="light"] select.form-control option {
    background: #ffffff;
    color: #0f172a;
}

[data-theme="light"] .modal {
    background: #ffffff;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: #cbd5e1;
}

[data-theme="light"] ::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Theme toggle button */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.theme-toggle:hover {
    background: var(--bg-hover);
    color: var(--accent-yellow);
    border-color: var(--accent-yellow);
}

/* Smooth transition for theme change */
html.theme-transitioning,
html.theme-transitioning *,
html.theme-transitioning *::before,
html.theme-transitioning *::after {
    transition: background-color 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease !important;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(20, 184, 166, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 80%, rgba(139, 92, 246, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

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

a:hover {
    color: var(--accent-teal);
}

/* ============ Scrollbar ============ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* ============ LOGIN PAGE ============ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}

.login-container {
    width: 100%;
    max-width: 440px;
    animation: fadeInUp 0.6s ease;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-teal), var(--accent-purple));
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 6px;
}

/* ============ LAYOUT ============ */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* ============ SIDEBAR ============ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-brand .brand-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-blue);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: var(--shadow-glow-blue);
}

.sidebar-brand h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.sidebar-brand small {
    display: block;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

.sidebar-menu {
    padding: 16px 12px;
    flex: 1;
}

.menu-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
    padding: 12px 12px 8px;
    white-space: nowrap;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    margin: 2px 0;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    cursor: pointer;
    white-space: nowrap;
    position: relative;
}

.menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.menu-item.active {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    font-weight: 600;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--accent-blue);
    border-radius: 0 3px 3px 0;
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
}

.menu-item .menu-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    min-width: 22px;
    text-align: center;
}

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

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

.sidebar-user .user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-full);
    background: var(--gradient-teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: white;
    flex-shrink: 0;
}

.sidebar-user .user-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.sidebar-user .user-info span {
    font-size: 11px;
    color: var(--accent-teal);
    text-transform: capitalize;
    font-weight: 500;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    min-width: 0;
    overflow-x: hidden;
    transition: var(--transition);
    min-height: 100vh;
}

/* ============ TOP HEADER ============ */
.top-header {
    height: var(--header-height);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 14, 26, 0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.page-title h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.page-title p {
    font-size: 13px;
    color: var(--text-secondary);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    position: relative;
}

.header-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.header-btn .dot {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    border: 2px solid var(--bg-primary);
}

/* ============ PAGE CONTENT ============ */
.page-content {
    padding: 28px 32px;
}

/* ============ STAT CARDS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.stat-card.blue::after {
    background: var(--gradient-blue);
}

.stat-card.teal::after {
    background: var(--gradient-teal);
}

.stat-card.purple::after {
    background: var(--gradient-purple);
}

.stat-card.orange::after {
    background: var(--gradient-orange);
}

.stat-card.pink::after {
    background: var(--gradient-pink);
}

.stat-card .stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.stat-card.blue .stat-icon {
    background: var(--gradient-blue);
    box-shadow: var(--shadow-glow-blue);
}

.stat-card.teal .stat-icon {
    background: var(--gradient-teal);
    box-shadow: var(--shadow-glow-teal);
}

.stat-card.purple .stat-icon {
    background: var(--gradient-purple);
}

.stat-card.orange .stat-icon {
    background: var(--gradient-orange);
}

.stat-card.pink .stat-icon {
    background: var(--gradient-pink);
}

.stat-card .stat-trend {
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-full);
}

.stat-trend.up {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

.stat-trend.down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============ CARDS ============ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 24px;
    transition: var(--transition);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-header h3 i {
    color: var(--accent-blue);
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ============ FORM ELEMENTS ============ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    letter-spacing: 0.3px;
}

.form-group label .required {
    color: var(--accent-red);
    margin-left: 2px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 5.5l6.5 6.5 6.5-6.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
    cursor: pointer;
}

select.form-control option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.input-group {
    position: relative;
}

.input-group .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 16px;
}

.input-group .form-control {
    padding-left: 42px;
}

.input-group .input-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    cursor: pointer;
    background: none;
    border: none;
    font-size: 16px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: var(--gradient-blue);
    color: white;
    box-shadow: var(--shadow-glow-blue);
}

.btn-primary:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.4);
    color: white;
}

.btn-success {
    background: var(--gradient-teal);
    color: white;
    box-shadow: var(--shadow-glow-teal);
}

.btn-success:hover {
    box-shadow: 0 0 30px rgba(20, 184, 166, 0.4);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.btn-purple {
    background: var(--gradient-purple);
    color: white;
}

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

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 12px;
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ============ TABLE ============ */
.table-container {
    overflow-x: auto;
}

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

.data-table th {
    padding: 14px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    background: rgba(15, 23, 42, 0.5);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: var(--transition-fast);
}

.data-table tbody tr:hover {
    background: var(--bg-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--accent-green);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--accent-red);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--accent-yellow);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
}

.badge-purple {
    background: rgba(139, 92, 246, 0.15);
    color: var(--accent-purple);
}

.badge-teal {
    background: rgba(20, 184, 166, 0.15);
    color: var(--accent-teal);
}

/* ============ MODAL ============ */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.show {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.modal-lg {
    max-width: 720px;
}

.modal-xl {
    max-width: 900px;
}

.modal-header {
    padding: 24px 24px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 0 24px 24px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============ PAGINATION ============ */
.pagination {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pagination .page-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
    padding: 0 8px;
}

.pagination .page-btn:hover {
    background: var(--bg-hover);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.pagination .page-btn.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    font-weight: 600;
}

.pagination .page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ============ ALERTS ============ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--accent-green);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: var(--accent-yellow);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: var(--accent-blue);
}

/* ============ FILE UPLOAD ============ */
.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-input);
}

.file-upload-zone:hover,
.file-upload-zone.dragover {
    border-color: var(--accent-blue);
    background: rgba(59, 130, 246, 0.05);
}

.file-upload-zone i {
    font-size: 32px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.file-upload-zone p {
    color: var(--text-secondary);
    font-size: 14px;
}

.file-upload-zone small {
    color: var(--text-muted);
    font-size: 12px;
}

.file-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.file-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-glass);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-secondary);
}

.file-item .remove-file {
    cursor: pointer;
    color: var(--accent-red);
    font-size: 14px;
}

/* ============ FILTER BAR ============ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.filter-bar .form-control {
    max-width: 200px;
}

.filter-bar .search-box {
    position: relative;
    flex: 1;
    min-width: 200px;
    max-width: 300px;
}

.filter-bar .search-box input {
    padding-left: 38px;
}

.filter-bar .search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* ============ CHARTS ============ */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.3s ease;
}

.toast-success {
    background: linear-gradient(135deg, #059669, #10b981);
}

.toast-error {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.toast-info {
    background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.toast-warning {
    background: linear-gradient(135deg, #d97706, #f59e0b);
}

/* ============ GRID LAYOUTS ============ */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

/* ============ BALANCE CARD ============ */
.balance-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: var(--transition);
}

.balance-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.balance-card .balance-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    margin: 0 auto 16px;
}

.balance-card .balance-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.balance-card .balance-amount {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
}

.balance-card .balance-type {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* ============ TOP EXPENSES ============ */
.expense-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
}

.expense-item:last-child {
    border-bottom: none;
}

.expense-item .exp-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

.expense-item .exp-info {
    flex: 1;
}

.expense-item .exp-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.expense-item .exp-info span {
    font-size: 12px;
    color: var(--text-muted);
}

.expense-item .exp-amount {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-red);
    white-space: nowrap;
}

/* ============ DETAIL VIEW ============ */
.detail-row {
    display: flex;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.detail-row .detail-label {
    width: 160px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-row .detail-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

/* ============ LOADING ============ */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
}

/* ============ ANIMATIONS ============ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Stagger animation for lists */
.animate-in {
    animation: fadeInUp 0.4s ease backwards;
}

.animate-in:nth-child(1) {
    animation-delay: 0.05s;
}

.animate-in:nth-child(2) {
    animation-delay: 0.1s;
}

.animate-in:nth-child(3) {
    animation-delay: 0.15s;
}

.animate-in:nth-child(4) {
    animation-delay: 0.2s;
}

.animate-in:nth-child(5) {
    animation-delay: 0.25s;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }

    .sidebar-toggle {
        display: flex;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }

    .card-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .filter-bar .form-control {
        max-width: 170px;
        font-size: 13px;
    }
}

@media (max-width: 768px) {
    .page-content {
        padding: 16px 12px;
    }

    .top-header {
        padding: 0 12px;
    }

    .page-title h2 {
        font-size: 16px;
    }

    .page-title p {
        font-size: 11px;
    }

    .card-header {
        padding: 16px;
    }

    .card-header h3 {
        font-size: 14px;
    }

    .card-body {
        padding: 16px;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-control,
    .filter-bar .search-box {
        max-width: none;
        width: 100%;
    }

    .filter-bar input[type="date"] {
        max-width: none !important;
        width: 100%;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px;
    }

    .stat-card .stat-value {
        font-size: 16px;
    }

    .stat-card .stat-label {
        font-size: 11px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Mobile card layout for data table */
    .data-table,
    .data-table thead,
    .data-table tbody,
    .data-table tfoot,
    .data-table th,
    .data-table td,
    .data-table tr {
        display: block;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody tr {
        background: var(--bg-card);
        border: 1px solid var(--border-color);
        border-radius: var(--radius-md);
        margin-bottom: 12px;
        padding: 12px 16px;
        position: relative;
    }

    .data-table tbody tr:hover {
        background: var(--bg-card);
    }

    .data-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 13px;
        text-align: right;
    }

    .data-table td:last-child {
        border-bottom: none;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: 0.5px;
        text-align: left;
        flex-shrink: 0;
        margin-right: 12px;
    }

    .data-table td div {
        max-width: none !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
    }

    /* Mobile footer totals */
    .data-table tfoot tr {
        background: rgba(59, 130, 246, 0.08);
        border: 1px solid rgba(59, 130, 246, 0.2);
        border-radius: var(--radius-md);
        padding: 12px 16px;
        margin-top: 8px;
    }

    .data-table tfoot td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 8px 0;
        border-bottom: 1px solid var(--border-color);
        font-size: 13px;
    }

    .data-table tfoot td:last-child {
        border-bottom: none;
    }

    .data-table tfoot td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        text-transform: uppercase;
        font-size: 11px;
        letter-spacing: 0.5px;
        text-align: left;
        flex-shrink: 0;
        margin-right: 12px;
    }

    .table-container {
        overflow-x: visible;
        padding: 0 16px 16px;
    }

    /* Button sizing */
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .page-content {
        padding: 12px 8px;
    }

    .top-header {
        padding: 0 10px;
        height: 56px;
    }

    .page-title h2 {
        font-size: 14px;
    }

    .page-title p {
        display: none;
    }

    .header-btn,
    .theme-toggle {
        width: 34px;
        height: 34px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .stat-card {
        padding: 10px;
    }

    .stat-card .stat-value {
        font-size: 14px;
    }

    .stat-card .stat-label {
        font-size: 10px;
    }

    .card-header {
        padding: 12px;
    }

    .card-body {
        padding: 12px;
    }

    .table-container {
        padding: 0 12px 12px;
    }

    .data-table td {
        font-size: 12px;
    }

    .data-table td::before {
        font-size: 10px;
    }

    .modal {
        border-radius: var(--radius-md);
    }
}

/* ============ UTILITY ============ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

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

.text-success {
    color: var(--accent-green);
}

.text-danger {
    color: var(--accent-red);
}

.text-warning {
    color: var(--accent-yellow);
}

.text-info {
    color: var(--accent-blue);
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.fw-bold {
    font-weight: 700;
}

.d-flex {
    display: flex;
}

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

.gap-2 {
    gap: 16px;
}

.flex-1 {
    flex: 1;
}