:root {
    --primary: #398a3b;
    --primary-hover: #2d6d2f;
    --secondary: #64748b;
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.95);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --success: #398a3b;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-width: 280px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --glass: rgba(255, 255, 255, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

/* Auth Layout */
#auth-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #1e3a8a, #3b82f6);
    position: relative;
    overflow: hidden;
}

#auth-page::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    background: url('https://www.transparenttextures.com/patterns/cubes.png');
    opacity: 0.1;
    animation: move 60s linear infinite;
}

@keyframes move {
    from {
        transform: translate(0, 0);
    }

    to {
        transform: translate(-50%, -50%);
    }
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 1.5rem;
    width: 100%;
    max-width: 450px;
    box-shadow: var(--shadow);
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.auth-card h1 {
    margin-bottom: 0.5rem;
    color: var(--primary);
    text-align: center;
}

.auth-card p {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* App Layout */
#app-layout {
    display: none;
    /* Shown after login */
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #0f172a;
    color: white;
    padding: 1.5rem;
    z-index: 100;
    transition: transform 0.3s ease;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: #94a3b8;
    border-radius: 0.5rem;
    transition: all 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    background: #1e293b;
    color: white;
}

.nav-links a.active {
    background: var(--primary);
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    min-height: 100vh;
    background: #f8fafc;
    transition: all 0.3s ease;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 16px;
    border-radius: 100px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* Components */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: var(--primary);
    opacity: 0.05;
    border-radius: 50%;
    transform: translate(30%, 30%);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Forms & Buttons */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: white;
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8fafc;
    text-align: left;
    padding: 1rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

tr:last-child td {
    border-bottom: none;
}

.badge {
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #166534;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 95%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Custom Scrollbar for Modal */
.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

/* Toasts */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 2000;
}

.toast {
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-left: 4px solid var(--primary);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

@media (max-width: 768px) {
    #admin-menu-toggle {
        display: block !important;
    }

    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.2);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }

    .header {
        margin-bottom: 1.5rem;
        padding: 0.5rem 0;
        gap: 10px;
    }

    #page-title {
        font-size: 1.3rem;
    }

    .user-info span:first-child {
        display: none;
        /* Hide name on mobile to save space */
    }

    .user-info {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .card {
        padding: 1.5rem 1rem;
    }

    .table-container {
        border-radius: 8px;
        margin: 0 -1rem;
        /* Full width on mobile */
        width: calc(100% + 2rem);
    }

    th,
    td {
        padding: 12px 8px;
        white-space: nowrap;
        /* Force scrolling instead of squishing */
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }
}

/* Admin Card Layout */
.list-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.admin-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.admin-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.admin-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-card-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary);
    overflow: hidden;
    flex-shrink: 0;
}

.admin-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-card-body {
    flex: 1;
}

.admin-card-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.admin-card-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.admin-card-info {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.75rem 0;
    border-top: 1px solid #f1f5f9;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
}

.info-value {
    color: var(--text-main);
    font-weight: 500;
}

.admin-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    gap: 10px;
}

.admin-card-actions {
    display: flex;
    gap: 10px;
}

@media (max-width: 768px) {
    .list-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}