:root {
    --bg-color: #0d1117;
    --surface-color: rgba(22, 27, 34, 0.7);
    --surface-hover: rgba(48, 54, 61, 0.8);
    --border-color: rgba(255, 255, 255, 0.1);
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    
    /* Vibrant Accents */
    --accent-primary: #58a6ff;
    --accent-glow: rgba(88, 166, 255, 0.4);
    --success: #2ea043;
    --warning: #d29922;
    --danger: #f85149;
    
    --sidebar-width: 260px;
    --header-height: 70px;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    /* Subtle background gradient */
    background-image: radial-gradient(circle at top right, rgba(88, 166, 255, 0.05), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(248, 81, 73, 0.05), transparent 40%);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
}

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

a:hover {
    color: #79c0ff;
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* === Layout === */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    border-right: 1px solid var(--border-color);
    border-radius: 0;
}

.sidebar-header {
    padding: 0 24px 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-header i {
    font-size: 28px;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

.sidebar-header h2 {
    font-size: 20px;
    letter-spacing: -0.5px;
    margin: 0;
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 16px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-secondary);
    border-radius: 10px;
    font-weight: 500;
    transition: var(--transition);
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent-primary);
    border-left: 3px solid var(--accent-primary);
}

.nav-item i {
    width: 20px;
    text-align: center;
    font-size: 18px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Header */
.top-header {
    height: var(--header-height);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(13, 17, 23, 0.8);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-search {
    position: relative;
    width: 300px;
}

.header-search i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.header-search input {
    width: 100%;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 10px 10px 36px;
    border-radius: 20px;
    outline: none;
    transition: var(--transition);
}

.header-search input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.header-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-profile .user-info {
    text-align: right;
}

.header-profile .user-name {
    font-weight: 600;
    font-size: 14px;
}

.header-profile .user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.logout-btn {
    background: rgba(248, 81, 73, 0.1);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.2);
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.logout-btn:hover {
    background: var(--danger);
    color: white;
}

/* Content Area */
.content-area {
    padding: 30px;
    flex: 1;
}

/* === Login Page Styles === */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 40px;
    text-align: center;
}

.login-header {
    margin-bottom: 30px;
}

.login-header .logo-icon {
    font-size: 48px;
    color: var(--accent-primary);
    margin-bottom: 15px;
    filter: drop-shadow(0 0 15px var(--accent-glow));
}

.login-header h2 {
    font-size: 24px;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    outline: none;
    transition: var(--transition);
}

.form-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #3182ce;
}

.btn-glow {
    box-shadow: 0 0 15px var(--accent-glow);
}

.btn-glow:hover {
    box-shadow: 0 0 25px var(--accent-glow);
    transform: translateY(-2px);
}

.alert {
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-danger {
    background: rgba(248, 81, 73, 0.1);
    color: var(--danger);
    border: 1px solid rgba(248, 81, 73, 0.2);
}

.login-footer {
    margin-top: 30px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Base Cards */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: rgba(88, 166, 255, 0.1); color: var(--accent-primary); }
.stat-icon.green { background: rgba(46, 160, 67, 0.1); color: var(--success); }
.stat-icon.yellow { background: rgba(210, 153, 34, 0.1); color: var(--warning); }
.stat-icon.red { background: rgba(248, 81, 73, 0.1); color: var(--danger); }

.stat-info h3 {
    font-size: 32px;
    margin: 5px 0 0;
}

.stat-info p {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
}

/* Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    cursor: grab;
}

.table-container.active {
    cursor: grabbing;
    user-select: none;
}

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

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-pending { background: rgba(210, 153, 34, 0.1); color: var(--warning); border: 1px solid rgba(210, 153, 34, 0.2); }
.badge-paid { background: rgba(46, 160, 67, 0.1); color: var(--success); border: 1px solid rgba(46, 160, 67, 0.2); }
.badge-overdue { background: rgba(248, 81, 73, 0.1); color: var(--danger); border: 1px solid rgba(248, 81, 73, 0.2); }

/* Quick Actions */
.action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    margin: 0 3px;
    transition: transform 0.2s ease, color 0.3s ease;
}

.action-btn:hover {
    color: var(--accent-primary);
    transform: scale(1.3);
}

.action-btn.delete:hover {
    color: var(--danger);
    transform: scale(1.3);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    transform: translateY(-20px);
    transition: var(--transition);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

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

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
}

.close-modal:hover {
    color: var(--danger);
}

/* Utility */
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mt-20 { margin-top: 20px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.section-title { font-size: 20px; margin-bottom: 20px; }

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-wrapper {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        position: static;
        flex-direction: row;
        padding: 10px 15px;
        align-items: center;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        white-space: nowrap;
    }
    
    .sidebar-header {
        padding: 0 15px 0 0;
    }
    
    .sidebar-header h2 {
        display: none;
    }
    
    .sidebar-nav {
        flex-direction: row;
        padding: 0;
        gap: 5px;
        width: max-content;
    }
    
    .nav-item {
        padding: 8px 12px;
        border-bottom: none;
        border-left: none;
    }
    
    .nav-item.active {
        border-left: none;
        border-bottom: 2px solid var(--accent-primary);
    }
    
    .nav-item span {
        display: none;
    }
    
    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }
    
    .top-header {
        padding: 0 15px;
        flex-direction: row;
        gap: 10px;
    }
    
    .header-search {
        width: 100%;
        max-width: none;
        flex: 1;
    }
    
    .header-profile .user-name {
        display: none;
    }
    
    .header-profile .user-role {
        display: none;
    }

    .logout-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .content-area {
        padding: 15px;
    }
    
    .flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    
    .stackable-grid {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .table-container {
        padding-bottom: 10px;
    }
}
