@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #f3f2fa;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --color-text: #1b1926;
    --color-text-secondary: #6e6b80;
    
    --brand-purple: #8553f4;
    --brand-purple-hover: #723ee2;
    --brand-purple-light: #f1eff9;
    
    --border-color: #eae8f0;
    --border-radius-large: 24px;
    --border-radius-medium: 16px;
    --border-radius-small: 12px;
    --box-shadow-soft: 0 10px 30px rgba(133, 83, 244, 0.04);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-primary);
    color: var(--color-text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--brand-purple);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    text-decoration: none;
}

.sidebar-brand i {
    font-size: 1.6rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--border-radius-medium);
    transition: all 0.2s ease;
}

.sidebar-menu a i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-menu a:hover {
    background-color: #faf9fd;
    color: var(--brand-purple);
}

.sidebar-menu a.active {
    background-color: var(--brand-purple);
    color: #ffffff;
}

.sidebar-footer {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-profile .avatar {
    width: 42px;
    height: 42px;
    background-color: var(--brand-purple-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand-purple);
    font-size: 1.2rem;
}

.user-profile .user-info {
    display: flex;
    flex-direction: column;
}

.user-profile .user-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--color-text);
}

.user-profile .user-role {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #ef4444;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-small);
    transition: background 0.2s;
}

.logout-btn:hover {
    background-color: #fef2f2;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.content-header {
    background-color: #ffffff;
    border-bottom: 1px solid var(--border-color);
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.content-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--color-text);
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text);
    cursor: pointer;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem 2.5rem;
    flex: 1;
}

/* Auth Layout */
.auth-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
}

.auth-layout .container {
    max-width: 480px;
    padding: 0;
    margin: 0;
}

/* Cards */
.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius-large);
    padding: 2rem;
    box-shadow: var(--box-shadow-soft);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.card h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}

.card h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.card p {
    color: var(--color-text-secondary);
}

.form-card {
    max-width: 480px;
    margin: 0 auto;
}

/* Stat Grid & Stat Boxes */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.5rem;
}

.stat-box {
    border-radius: var(--border-radius-large);
    padding: 1.75rem;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: var(--box-shadow-soft);
    transition: transform 0.2s ease;
}

.stat-box:hover {
    transform: translateY(-2px);
}

.stat-box .num {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 0.4rem;
}

.stat-box .label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Yellow stat-box (1) */
.stat-box:nth-child(1) {
    background-color: #fffde6;
    border-color: #fcf6b1;
}
.stat-box:nth-child(1) .num { color: #856404; }
.stat-box:nth-child(1) .label { color: #b28a1a; }

/* Green stat-box (2) */
.stat-box:nth-child(2) {
    background-color: #edf5e8;
    border-color: #dbead2;
}
.stat-box:nth-child(2) .num { color: #3b602b; }
.stat-box:nth-child(2) .label { color: #52803f; }

/* Blue stat-box (3) */
.stat-box:nth-child(3) {
    background-color: #edf4fe;
    border-color: #d6e5fc;
}
.stat-box:nth-child(3) .num { color: #1e40af; }
.stat-box:nth-child(3) .label { color: #3b66f5; }

/* Purple stat-box (4) */
.stat-box:nth-child(4) {
    background-color: #f6f2fe;
    border-color: #ebdffc;
}
.stat-box:nth-child(4) .num { color: #5b21b6; }
.stat-box:nth-child(4) .label { color: #8553f4; }

/* Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
}

table th, table td {
    padding: 1rem 1.25rem;
    text-align: left;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
}

table th {
    background-color: #faf9fd;
    color: var(--color-text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

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

table tbody tr:hover {
    background-color: #faf9fd;
}

/* Forms & Inputs */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--color-text);
}

input[type=text],
input[type=email],
input[type=password],
input[type=number],
textarea,
select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #dcdbe5;
    border-radius: var(--border-radius-small);
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--color-text);
    background-color: #faf9fd;
    transition: all 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--brand-purple);
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(133, 83, 244, 0.12);
}

textarea {
    resize: vertical;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius-small);
    border: none;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

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

.btn-primary {
    background-color: var(--brand-purple);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--brand-purple-hover);
    box-shadow: 0 4px 12px rgba(133, 83, 244, 0.25);
}

.btn-secondary {
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
}

.btn-secondary:hover {
    background-color: #e5dffa;
}

.btn-danger {
    background-color: #fef2f2;
    color: #ef4444;
}

.btn-danger:hover {
    background-color: #fee2fee2;
    background-color: #fee2e2;
}

.btn-success {
    background-color: #ecfdf5;
    color: #10b981;
}

.btn-success:hover {
    background-color: #d1fae5;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 8px;
}

/* Toolbar & Filters */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar h1 {
    margin-bottom: 0;
}

.filters {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    align-items: center;
    background: #ffffff;
    padding: 1rem;
    border-radius: var(--border-radius-medium);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.filters select,
.filters input {
    width: auto;
    min-width: 150px;
}

.filters input.search-input {
    flex: 2;
    min-width: 250px;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* Badge & Flags */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
}

.correct-flag {
    color: #10b981;
    font-weight: 700;
}

.wrong-flag {
    color: #ef4444;
    font-weight: 700;
}

/* Alerts */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-medium);
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    border: 1px solid transparent;
}

.alert-error {
    background-color: #fef2f2;
    color: #b91c1c;
    border-color: #fee2e2;
}

.alert-success {
    background-color: #ecfdf5;
    color: #047857;
    border-color: #d1fae5;
}

/* Misc Utilities */
.row {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.row > * {
    flex: 1;
    min-width: 220px;
}

.alt-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    margin-bottom: 0.75rem;
}

.alt-row input[type=text] {
    flex: 1;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-small);
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    color: var(--color-text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination a:hover {
    background-color: var(--brand-purple-light);
    color: var(--brand-purple);
    border-color: var(--brand-purple);
}

.pagination a.active {
    background-color: var(--brand-purple);
    color: #ffffff;
    border-color: var(--brand-purple);
}

/* Responsive Styling */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
    }
    
    .mobile-toggle {
        display: block;
    }
    
    .content-header {
        padding: 1rem 1.5rem;
    }
    
    .container {
        padding: 1.5rem;
    }
}

@media (max-width: 576px) {
    .row {
        flex-direction: column;
    }
    .filters select,
    .filters input {
        width: 100%;
    }
}
