/* =========================================================
   CollegeLive Support - admin panel
   ========================================================= */

:root {
    --brand: #4f46e5;
    --brand-dark: #3730a3;
    --accent: #06b6d4;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --bg: #f1f5f9;
    --card: #ffffff;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', 'Inter', 'Roboto', Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--brand);
    text-decoration: none;
}

h1, h2, h3, h4 {
    margin: 0 0 10px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.02em;
}

p {
    margin: 0 0 12px;
}

/* ---------- Shell ---------- */

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

.admin-sidebar {
    width: 248px;
    flex: 0 0 248px;
    min-height: 100vh;
    padding: 24px 18px;
    color: #cbd5e1;
    background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
    position: sticky;
    top: 0;
    align-self: flex-start;
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 30px;
    color: #fff;
}

.admin-brand:hover {
    color: #fff;
}

.admin-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand), var(--accent));
}

.admin-brand strong {
    display: block;
    font-size: 15.5px;
    line-height: 1.2;
}

.admin-brand small {
    display: block;
    font-size: 10.5px;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.admin-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 13px;
    border-radius: 10px;
    color: #cbd5e1;
    font-size: 13.5px;
    font-weight: 600;
    transition: background .18s ease, color .18s ease;
}

.admin-nav a:hover {
    background: rgba(255, 255, 255, .07);
    color: #fff;
}

.admin-nav a.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #fff;
    box-shadow: 0 8px 18px rgba(79, 70, 229, .35);
}

.admin-nav .nav-label {
    margin: 20px 10px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: #64748b;
    font-weight: 800;
}

.nav-badge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    margin-left: auto;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 10.5px;
    font-weight: 800;
    line-height: 1;
}

.admin-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.admin-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 30px;
    background: #fff;
    border-bottom: 1px solid var(--line);
}

.admin-topbar h1 {
    font-size: 20px;
    margin: 0;
}

.admin-topbar small {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13px;
    color: var(--muted);
}

.admin-user strong {
    color: var(--ink);
}

.admin-content {
    padding: 26px 30px 46px;
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid transparent;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .16s ease, background .16s ease, border-color .16s ease;
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    box-shadow: 0 8px 18px rgba(79, 70, 229, .25);
}

.btn-primary:hover {
    color: #fff;
    transform: translateY(-1px);
}

.btn-light {
    color: var(--ink);
    background: #fff;
    border-color: var(--line);
}

.btn-light:hover {
    color: var(--brand);
    border-color: #c7d2fe;
}

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

.btn-danger:hover {
    color: #fff;
    background: #b91c1c;
}

.btn-success {
    color: #fff;
    background: var(--success);
}

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

.btn-sm {
    min-height: 32px;
    padding: 6px 11px;
    border-radius: 8px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* ---------- Cards and stats ---------- */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.card-body {
    padding: 22px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--line);
}

.card-head h2 {
    margin: 0;
    font-size: 16.5px;
}

.card-head p {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 12.5px;
}

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

.stat-card {
    padding: 20px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .04);
}

.stat-label {
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .08em;
}

.stat-value {
    margin-top: 6px;
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -.03em;
    background: linear-gradient(135deg, var(--brand), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-note {
    color: var(--muted);
    font-size: 12px;
}

/* ---------- Alerts ---------- */

.alert {
    padding: 12px 15px;
    border-radius: 11px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 18px;
}

.alert-success {
    color: #065f46;
    background: #d1fae5;
    border: 1px solid #a7f3d0;
}

.alert-error {
    color: #991b1b;
    background: #fee2e2;
    border: 1px solid #fecaca;
}

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

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

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

table.admin-table th,
table.admin-table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

table.admin-table th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #f8fafc;
    white-space: nowrap;
}

table.admin-table tbody tr:hover {
    background: #f8fafc;
}

table.admin-table .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

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

/* ---------- Badges ---------- */

.badge {
    display: inline-block;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .02em;
}

.badge-new {
    color: #92400e;
    background: #fef3c7;
}

.badge-contacted {
    color: #1e40af;
    background: #dbeafe;
}

.badge-converted {
    color: #065f46;
    background: #d1fae5;
}

.badge-admitted {
    color: #065f46;
    background: #d1fae5;
}

.badge-muted {
    color: #475569;
    background: #e2e8f0;
}

/* ---------- Forms ---------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid .full {
    grid-column: 1 / -1;
}

.field label {
    display: block;
    margin-bottom: 5px;
    font-size: 11.5px;
    font-weight: 800;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="tel"],
.field select,
.field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.field textarea {
    min-height: 96px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

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

.check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    padding: 4px 0;
}

.check-row label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    text-transform: none;
    letter-spacing: 0;
    margin: 0;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
}

.inline-form .field {
    min-width: 180px;
}

/* ---------- Two-column layout ---------- */

.admin-grid {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.admin-grid.wide-left {
    grid-template-columns: minmax(0, 1fr) 340px;
}

/* ---------- Chat transcript ---------- */

.transcript {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 520px;
    overflow-y: auto;
    padding: 4px;
}

.transcript-row {
    display: flex;
    flex-direction: column;
    max-width: 82%;
}

.transcript-row.user {
    align-self: flex-end;
    text-align: right;
}

.transcript-row.bot {
    align-self: flex-start;
}

.transcript-row.system {
    align-self: center;
    max-width: 100%;
    text-align: center;
}

.transcript-row.system .transcript-bubble {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #3730a3;
    font-size: 12px;
}

.transcript-meta {
    margin-bottom: 3px;
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
}

.transcript-bubble {
    padding: 9px 12px;
    border-radius: 12px;
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-line;
    background: #f1f5f9;
    color: #1f2937;
    border: 1px solid var(--line);
}

.transcript-row.user .transcript-bubble {
    background: #eef2ff;
    color: #3730a3;
    border-color: #c7d2fe;
}

/* ---------- Detail list ---------- */

.detail-list {
    display: grid;
    gap: 10px;
    margin: 0;
}

.detail-list div {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    gap: 10px;
    font-size: 13px;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
    color: var(--ink);
    word-break: break-word;
}

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

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(79, 70, 229, .25), transparent 34%),
        radial-gradient(circle at 85% 10%, rgba(6, 182, 212, .22), transparent 34%),
        #0f172a;
}

.login-card {
    width: 100%;
    max-width: 410px;
    padding: 34px;
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.login-brand .admin-brand-mark {
    width: 46px;
    height: 46px;
}

.login-brand strong {
    display: block;
    font-size: 18px;
    font-weight: 800;
}

.login-brand small {
    display: block;
    color: var(--muted);
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-weight: 700;
}

.login-note {
    margin-top: 16px;
    padding: 11px 13px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.login-note strong {
    color: var(--ink);
}

.field-error {
    margin-top: 4px;
    color: var(--danger);
    font-size: 11.5px;
    font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
    .admin-grid,
    .admin-grid.wide-left {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 780px) {
    .admin-shell {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        flex: 0 0 auto;
        min-height: 0;
        position: static;
        padding: 16px;
    }

    .admin-brand {
        margin-bottom: 14px;
    }

    .admin-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .admin-nav .nav-label {
        display: none;
    }

    .admin-nav a {
        padding: 8px 11px;
        font-size: 12.5px;
    }

    .admin-topbar {
        padding: 14px 18px;
        flex-wrap: wrap;
    }

    .admin-content {
        padding: 18px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }
}
