/* ---------------------------------------------------------------
   Lerning App — Admin Panel
   Self-contained stylesheet (no build step required).
   --------------------------------------------------------------- */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --border: #e4e8f0;
    --text: #1c2333;
    --muted: #6b7385;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef0ff;
    --success: #16a34a;
    --success-soft: #e9f9ef;
    --danger: #dc2626;
    --danger-soft: #fdeaea;
    --warning: #d97706;
    --warning-soft: #fdf3e3;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout ------------------------------------------------------ */

.shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: #171d31;
    color: #d6daea;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    gap: 24px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 18px;
}

.brand-name { font-weight: 600; color: #fff; letter-spacing: .2px; }

.sidebar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.sidebar nav a {
    color: #c2c8dd;
    padding: 9px 12px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14.5px;
}

.sidebar nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }

.sidebar nav a.active { background: var(--primary); color: #fff; }

.sidebar-footer { display: flex; flex-direction: column; gap: 10px; }

.user-chip { display: flex; gap: 10px; align-items: center; padding: 10px 8px 0; }

.avatar {
    display: inline-flex;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-weight: 700;
    align-items: center;
    justify-content: center;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.25; }
.user-meta strong { color: #fff; font-size: 13.5px; }
.user-meta small { color: #8a91aa; font-size: 12px; }

.content {
    flex: 1;
    padding: 28px 32px;
    min-width: 0;
}

.content.no-pad { padding: 0; }

/* Headers ------------------------------------------------------ */

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.page-head h1 { margin: 0; font-size: 22px; font-weight: 700; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Cards & grids ------------------------------------------------ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px 20px;
}

.stat-card .label { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat-card .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat-card .hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

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

.card-body { padding: 20px; }

/* Tables ------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.table th, .table td {
    padding: 11px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.table th {
    background: #fafbfe;
    color: var(--muted);
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
}

.table tbody tr:hover { background: #fafbff; }
.table tbody tr:last-child td { border-bottom: none; }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Buttons & forms ---------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    background: var(--primary);
    color: #fff;
    line-height: 1.35;
}

.btn:hover { background: var(--primary-dark); text-decoration: none; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: #f4f5fb; color: var(--text); }

.btn-ghost { background: transparent; color: inherit; }
.btn-ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

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

.btn-block { width: 100%; }

form.inline { display: inline; }

label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }

.form-group { margin-bottom: 16px; }

.form-row { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 720px) { .form-row { grid-template-columns: 1fr; } }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=url], select, textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary-soft);
    border-color: var(--primary);
}

.hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; }

/* Alerts, badges, pagination ------------------------------------ */

.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: #14532d; border-color: #bce8cd; }
.alert-error { background: var(--danger-soft); color: #7f1d1d; border-color: #f5c6c6; }

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    padding: 2px 8px;
    background: #eef0f5;
    color: var(--muted);
    white-space: nowrap;
}

.badge-active { background: var(--success-soft); color: var(--success); }
.badge-hidden { background: var(--warning-soft); color: var(--warning); }
.badge-flag-review { background: var(--warning-soft); color: var(--warning); }
.badge-flag-flagged { background: var(--danger-soft); color: var(--danger); }

.invalid-feedback { color: var(--danger); font-size: 13px; margin-top: 4px; }

.pagination { display: flex; gap: 6px; margin: 18px 0; flex-wrap: wrap; }
.pagination a, .pagination span {
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13.5px;
    background: var(--surface);
    color: var(--text);
}
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination a:hover { text-decoration: none; background: #f4f5fb; }

/* Login page ---------------------------------------------------- */

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #171d31 0%, #232c4d 100%);
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border-radius: 14px;
    padding: 34px 30px;
    box-shadow: 0 20px 45px rgba(10, 14, 30, .35);
}

.login-card h1 { margin: 0 0 4px; font-size: 21px; }
.login-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.login-card .btn { margin-top: 8px; }

/* Misc ----------------------------------------------------------- */

.empty {
    text-align: center;
    color: var(--muted);
    padding: 36px 20px;
    font-size: 14px;
}

.filter-bar {
    display: flex;
    gap: 10px;
    align-items: end;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: #fafbfe;
}

.filter-bar .field { display: flex; flex-direction: column; min-width: 150px; }
.filter-bar label { font-size: 12.5px; color: var(--muted); }

.thumb {
    width: 74px;
    height: 42px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: block;
    background: #eef0f5;
}

.meta-muted { color: var(--muted); font-size: 13px; }

.progress-track {
    height: 7px;
    border-radius: 999px;
    background: #eceef4;
    overflow: hidden;
    min-width: 90px;
}

.progress-bar { height: 100%; background: var(--primary); border-radius: 999px; }

.nowrap { white-space: nowrap; }
