/* ═══════════════════════════════════════════════════════════
   ADMIN DASHBOARD CSS
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg:          #080c18;
    --bg-sidebar:  #0b1120;
    --bg-card:     #111827;
    --bg-input:    #1a2234;
    --border:      #1e2d47;
    --blue:        #4f8ef7;
    --blue-light:  #7fb3ff;
    --purple:      #8b5cf6;
    --green:       #10b981;
    --orange:      #f59e0b;
    --red:         #ef4444;
    --cyan:        #22d3ee;
    --text:        #e2e8f0;
    --text-muted:  #64748b;
    --text-dim:    #94a3b8;
    --sidebar-w:   260px;
    --header-h:    64px;
    --radius:      10px;
    --transition:  all 0.25s ease;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    min-height: 100vh;
    position: fixed;
    top: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 200;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
}

.sidebar-brand-logo {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

.sidebar-brand-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
    display: block;
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 16px 8px 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    position: relative;
}

.sidebar-link:hover {
    background: rgba(79,142,247,0.08);
    color: var(--blue-light);
}

.sidebar-link.active {
    background: rgba(79,142,247,0.12);
    color: var(--blue-light);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--blue);
    border-radius: 0 3px 3px 0;
}

.sidebar-link .icon {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-link .badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 100px;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    margin-bottom: 6px;
}

.sidebar-user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.sidebar-user-name {
    font-size: 0.875rem;
    font-weight: 600;
    display: block;
}

.sidebar-user-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
}

/* ── Main Content ─────────────────────────────────────────── */
.admin-main {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────── */
.admin-header {
    height: var(--header-h);
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header-title {
    font-size: 1.05rem;
    font-weight: 600;
}

.admin-header-breadcrumb {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: var(--radius);
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.header-btn-view {
    background: rgba(79,142,247,0.1);
    color: var(--blue-light);
    border: 1px solid rgba(79,142,247,0.2);
}
.header-btn-view:hover { background: rgba(79,142,247,0.2); }

.header-btn-logout {
    background: rgba(239,68,68,0.08);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.2);
}
.header-btn-logout:hover { background: rgba(239,68,68,0.15); }

/* ── Page Content ─────────────────────────────────────────── */
.admin-content {
    flex: 1;
    padding: 28px;
    overflow-y: auto;
}

/* ── Stats Cards ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}

.stat-card.blue::before  { background: linear-gradient(90deg, var(--blue), var(--purple)); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--green), var(--cyan)); }
.stat-card.orange::before { background: linear-gradient(90deg, var(--orange), var(--red)); }
.stat-card.purple::before { background: linear-gradient(90deg, var(--purple), var(--pink, #f472b6)); }
.stat-card.cyan::before   { background: linear-gradient(90deg, var(--cyan), var(--blue)); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--red), var(--orange)); }

.stat-card:hover {
    border-color: rgba(79,142,247,0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.stat-icon {
    font-size: 1.8rem;
    margin-bottom: 12px;
}

.stat-num {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Tables ───────────────────────────────────────────────── */
.table-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

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

.table-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.table-actions {
    display: flex;
    gap: 8px;
}

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

.admin-table th {
    padding: 12px 20px;
    text-align: left;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 14px 20px;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}

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

.admin-table tr:hover td { background: rgba(255,255,255,0.02); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue), var(--purple));
    color: white;
    box-shadow: 0 2px 10px rgba(79,142,247,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(79,142,247,0.4); }

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-dim);
    border: 1px solid var(--border);
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

.btn-danger {
    background: rgba(239,68,68,0.1);
    color: #fca5a5;
    border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover { background: rgba(239,68,68,0.2); }

.btn-success {
    background: rgba(16,185,129,0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16,185,129,0.2);
}
.btn-success:hover { background: rgba(16,185,129,0.2); }

.btn-warning {
    background: rgba(245,158,11,0.1);
    color: #fde68a;
    border: 1px solid rgba(245,158,11,0.2);
}
.btn-warning:hover { background: rgba(245,158,11,0.2); }

/* ── Forms ────────────────────────────────────────────────── */
.form-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
}

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

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.form-required { color: var(--red); }

.form-control {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(79,142,247,0.1);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control option { background: var(--bg-card); }

textarea.form-control { resize: vertical; min-height: 120px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 18px; height: 18px;
    accent-color: var(--blue);
    cursor: pointer;
}

/* Image preview */
.image-preview {
    width: 100%;
    max-width: 280px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    margin-bottom: 12px;
}

.image-preview img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.image-preview-placeholder {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Skill level input */
.level-input-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.level-display {
    font-weight: 700;
    color: var(--blue-light);
    min-width: 45px;
    text-align: center;
}

input[type="range"] {
    flex: 1;
    accent-color: var(--blue);
    height: 6px;
    cursor: pointer;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.875rem;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success {
    background: rgba(16,185,129,0.08);
    border: 1px solid rgba(16,185,129,0.2);
    color: #6ee7b7;
}

.alert-error {
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.2);
    color: #fca5a5;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
}

.badge-blue   { background: rgba(79,142,247,0.1);  color: var(--blue-light); }
.badge-green  { background: rgba(16,185,129,0.1);  color: #6ee7b7; }
.badge-orange { background: rgba(245,158,11,0.1);  color: #fde68a; }
.badge-red    { background: rgba(239,68,68,0.1);   color: #fca5a5; }
.badge-purple { background: rgba(139,92,246,0.1);  color: #c4b5fd; }

/* ── Empty State ─────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-icon { font-size: 3rem; margin-bottom: 16px; opacity: 0.5; }
.empty-state-title { font-size: 1rem; font-weight: 600; margin-bottom: 8px; color: var(--text-dim); }
.empty-state-text { font-size: 0.875rem; }

/* ── Page Header ─────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 700;
}

.page-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Progress bar ─────────────────────────────────────────── */
.skill-bar {
    height: 5px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    margin-top: 6px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--blue), var(--purple));
    border-radius: 3px;
}

/* ── Pagination ───────────────────────────────────────────── */
.pagination-wrap { display: flex; justify-content: center; margin-top: 20px; }

/* ── Responsive ───────────────────────────────────────────── */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 300;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 8px 10px;
    cursor: pointer;
    color: var(--text);
}

@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .sidebar-toggle { display: block; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
    .admin-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* Sidebar overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 190;
}

.sidebar-overlay.active { display: block; }

/* Recent messages */
.message-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}

.message-item:last-child { border-bottom: none; }
.message-item:hover { background: rgba(255,255,255,0.02); }

.message-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.message-name { font-size: 0.875rem; font-weight: 600; }
.message-subject { font-size: 0.8rem; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.message-time { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; flex-shrink: 0; }
.message-unread .message-name::after { content: '●'; color: var(--blue); font-size: 0.5rem; margin-left: 6px; vertical-align: middle; }
