:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: rgba(79, 70, 229, 0.1);
    --secondary: #64748b;
    --dark: #0f172a;
    --light: #f8fafc;
    --white: #ffffff;
    --danger: #ef4444;
    --success: #10b981;
    --warning: #f59e0b;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #f1f5f9;
    color: var(--dark);
    line-height: 1.6;
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,0.03) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,0.03) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,0.03) 0, transparent 50%);
    background-attachment: fixed;
}

/* App Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling (Modern App Style) */
.sidebar {
    width: 260px;
    background: linear-gradient(135deg, var(--primary) 0%, #312e81 100%);
    color: var(--white);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow: hidden; /* For decorative circles */
}

/* Decorative background shapes for sidebar */
.sidebar::before {
    content: ''; position: absolute; width: 300px; height: 300px;
    background: rgba(255,255,255,0.03); border-radius: 50%;
    top: -50px; left: -100px; z-index: 0; pointer-events: none;
}
.sidebar::after {
    content: ''; position: absolute; width: 200px; height: 200px;
    background: rgba(255,255,255,0.02); border-radius: 50%;
    bottom: 50px; right: -50px; z-index: 0; pointer-events: none;
}

.sidebar-content-wrapper {
    position: relative;
    z-index: 1; /* Stay above decorations */
    display: flex;
    flex-direction: column;
    height: 100%;
    justify-content: space-between;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h2 {
    font-weight: 700;
    font-size: 22px;
    letter-spacing: -0.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links {
    list-style: none;
    padding: 20px 10px;
}

.nav-links li {
    margin-bottom: 5px;
}

.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-radius: 10px;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 15px;
}

.nav-links a i {
    margin-right: 12px;
    width: 20px;
    text-align: center;
    font-size: 16px;
    color: #94a3b8; /* slightly muted icon color */
    transition: all 0.2s ease;
}

.nav-links a:hover, .nav-links a.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    transform: translateX(4px);
    box-shadow: inset 2px 0 0 0 #fff; /* A crisp white line on the left */
}

.nav-links a:hover i, .nav-links a.active i {
    color: var(--white);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

/* Main Content Area */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 30px 40px;
    width: calc(100% - 260px);
}

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

.page-header h1 {
    font-weight: 700;
    color: var(--dark);
    font-size: 26px;
    letter-spacing: -0.5px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--white);
    padding: 6px 15px 6px 6px;
    border-radius: 50px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* Cards (Glassmorphism) */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--glass-shadow);
    padding: 25px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    font-size: 32px;
    color: var(--primary);
    background: var(--primary-light);
    width: 65px;
    height: 65px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    margin-right: 20px;
}

.card-content h3 {
    font-size: 14px;
    color: var(--secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-content p {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark);
    margin-top: 5px;
    line-height: 1;
}

/* General Form Card */
.form-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--glass-shadow);
    padding: 30px;
    border-radius: 16px;
}

/* Tables */
.table-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--glass-shadow);
    border-radius: 16px;
    overflow: hidden;
}

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

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

th {
    background-color: rgba(248, 250, 252, 0.8);
    color: var(--secondary);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

td {
    color: var(--dark);
    font-size: 15px;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background-color: rgba(241, 245, 249, 0.5);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.input-icon {
    position: relative;
}

.input-icon i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--secondary);
}

.input-icon input, .input-icon select {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    font-size: 15px;
    transition: all 0.2s;
    background: var(--white);
}

.input-icon input:focus, .input-icon select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-size: 15px;
    text-decoration: none;
    text-align: center;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 8px -1px rgba(79, 70, 229, 0.4);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.3);
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 6px;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-primary { background: #e0e7ff; color: #3730a3; }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #b91c1c;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #b45309;
}

/* Auth Pages */
.login-page {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-container {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--glass-shadow);
    border-radius: 24px;
    padding: 40px;
}

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

.login-header h2 {
    color: var(--primary);
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 10px;
    letter-spacing: -1px;
}

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

.login-footer {
    text-align: center;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    font-size: 14px;
}

/* Mobile Responsive Layout */
.mobile-nav-toggle {
    display: none;
    background: transparent;
    border: none;
    color: var(--dark);
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        width: 280px;
    }
    
    .sidebar.mobile-active {
        transform: translateX(0);
        box-shadow: 10px 0 50px rgba(0,0,0,0.5);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px 15px;
    }

    .mobile-nav-toggle {
        display: block;
    }

    .page-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .page-header h1 {
        font-size: 22px;
    }

    .user-profile {
        padding: 4px 10px 4px 4px;
    }

    .user-profile .badge {
        display: none; /* Hide initials on mobile to save space */
    }
    
    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 99;
        opacity: 0;
        transition: opacity 0.3s;
    }
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }
}
