/* Jeewani Group – Admin Dashboard */

:root {
    --accent: #b19777;
    --accent-dark: #8f7556;
    --accent-soft: #f6f1ea;
    --ink: #272727;
    --text: #4a4a4a;
    --muted: #7a7a7a;
    --line: #e7e3dd;
    --bg: #f7f5f2;
    --card: #ffffff;
    --success: #2e7d4f;
    --success-soft: #e7f4ec;
    --danger: #b3261e;
    --danger-soft: #fbeceb;
    --warning: #9a6200;
    --warning-soft: #fdf3e1;
    --info: #2f5f8a;
    --info-soft: #e9f1f8;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(39, 39, 39, .06), 0 4px 16px rgba(39, 39, 39, .04);
    --sidebar: 248px;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.6 'Didact Gothic', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

h1, h2, h3 { font-family: 'Oswald', sans-serif; font-weight: 500; color: var(--ink); letter-spacing: .02em; line-height: 1.25; }

a { color: var(--accent-dark); }
a:hover { color: var(--ink); }

code { font-size: 13px; background: var(--accent-soft); padding: 1px 6px; border-radius: 4px; word-break: break-all; }

.icon { width: 18px; height: 18px; flex: none; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.block { display: block; }
.req { color: var(--danger); }
.optional { color: var(--muted); font-weight: normal; font-size: 13px; font-family: 'Didact Gothic', sans-serif; letter-spacing: 0; }

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

.sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar);
    background: var(--ink); color: #d9d9d9;
    display: flex; flex-direction: column; z-index: 30;
    transition: transform .2s ease;
}
.sidebar-brand { display: block; padding: 22px 22px 18px; background: #fff; }
.sidebar-brand img { display: block; max-width: 150px; height: auto; }
.sidebar-nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.sidebar-nav a, .sidebar-logout button {
    display: flex; align-items: center; gap: 12px; width: 100%;
    padding: 11px 14px; margin-bottom: 2px; border-radius: 8px;
    color: #d9d9d9; text-decoration: none; font: inherit; background: none; border: 0; cursor: pointer; text-align: left;
}
.sidebar-nav a:hover, .sidebar-logout button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.sidebar-nav a.is-active { background: var(--accent); color: #fff; }
.sidebar-logout { padding: 10px; border-top: 1px solid rgba(255, 255, 255, .08); margin: 0; }
.sidebar-backdrop { display: none; }

.main { margin-left: var(--sidebar); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; gap: 14px;
    padding: 14px 32px; background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
}
.topbar-title { margin: 0; font-size: 22px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: 'Oswald', sans-serif; }
.menu-toggle { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; padding: 7px; cursor: pointer; color: var(--ink); }
.menu-toggle .icon { width: 22px; height: 22px; display: block; }

.content { padding: 28px 32px 60px; max-width: 1280px; width: 100%; }
.welcome { margin: 0 0 18px; font-size: 17px; color: var(--ink); }

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

.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; border: 1px solid transparent; }
.alert-success { background: var(--success-soft); color: var(--success); border-color: #cbe7d6; }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: #f2cfcc; }
.alert-warning { background: var(--warning-soft); color: var(--warning); border-color: #f3dfb8; }
.alert-info { background: var(--info-soft); color: var(--info); border-color: #cfe0ef; }
.alert a { color: inherit; font-weight: bold; }

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

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
    font: inherit; font-size: 14px; line-height: 1.2; text-decoration: none; cursor: pointer;
    transition: background .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); color: #fff; }
.btn-light { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-light:hover { border-color: var(--accent); color: var(--ink); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #24653f; color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1d17; }
.btn-danger-outline { background: #fff; color: var(--danger); border-color: #efc4c1; }
.btn-danger-outline:hover { background: var(--danger-soft); color: var(--danger); }
.btn-sm { padding: 7px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible {
    outline: 2px solid var(--accent); outline-offset: 2px;
}

/* ---------- Stats ---------- */

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.stat {
    display: flex; flex-direction: column; gap: 4px; padding: 20px 22px;
    background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
    border-top: 3px solid var(--line); text-decoration: none; color: var(--text);
}
.stat:hover { border-top-color: var(--accent); color: var(--text); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-family: 'Oswald', sans-serif; font-size: 34px; color: var(--ink); line-height: 1.1; }
.stat-success { border-top-color: var(--success); }
.stat-muted { border-top-color: #bdbdbd; }
.stat-accent { border-top-color: var(--accent); }

.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0; }

/* ---------- Panels ---------- */

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px; }
.panel.narrow { max-width: 760px; }
.panel-title { font-size: 18px; margin: 0 0 14px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.panel-head h2 { font-size: 18px; margin: 0; }
.panel-danger { border: 1px solid #f2d6d4; }
.grid-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.empty { color: var(--muted); margin: 8px 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a { text-decoration: none; color: var(--ink); min-width: 0; }
.list a strong { display: block; }
.list a .muted { font-size: 13px; }

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

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; line-height: 1.5; white-space: nowrap; background: #eee; color: #555; }
.badge-lg { font-size: 14px; padding: 6px 14px; }
.badge-published, .badge-hired { background: var(--success-soft); color: var(--success); }
.badge-draft { background: #efefef; color: #666; }
.badge-new { background: var(--info-soft); color: var(--info); }
.badge-under-review { background: var(--accent-soft); color: var(--accent-dark); }
.badge-shortlisted { background: #efe9f8; color: #5b3f8c; }
.badge-interview { background: #e6f4f4; color: #1f6f6f; }
.badge-selected { background: #eef6e4; color: #4d7a1f; }
.badge-rejected { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }

/* ---------- Toolbar / tabs ---------- */

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.tabs { display: flex; gap: 4px; background: #fff; padding: 4px; border-radius: 10px; box-shadow: var(--shadow); }
.tabs a { padding: 8px 14px; border-radius: 7px; text-decoration: none; color: var(--text); font-size: 14px; }
.tabs a span { color: var(--muted); font-size: 12px; margin-left: 4px; }
.tabs a.is-active { background: var(--ink); color: #fff; }
.tabs a.is-active span { color: #ccc; }

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

.table-wrap { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: normal; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #fbfaf8; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfbf9; }
.strong-link { color: var(--ink); font-weight: bold; text-decoration: none; }
.strong-link:hover { color: var(--accent-dark); text-decoration: underline; }
.actions { white-space: nowrap; }
.actions, .actions form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 0; }
.actions-col { width: 1%; }

.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; color: var(--muted); }

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

.field { margin-bottom: 18px; min-width: 0; }
fieldset.field { border: 0; padding: 0; margin: 0 0 18px; }
legend, .field > label, .section-heading-field label { display: block; font-weight: bold; color: var(--ink); margin-bottom: 6px; font-size: 14px; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input[type=number], input[type=date], select, textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #d8d3cc; border-radius: 8px;
    background: #fff; color: var(--ink); font: inherit; font-size: 15px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(177, 151, 119, .2); }
textarea { resize: vertical; }
.hint { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }
.hint.warn { color: var(--warning); }
.error { display: block; color: var(--danger); font-size: 13px; margin-top: 5px; }
.has-error input, .has-error select, .has-error .rte { border-color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.checkbox, .radio { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 8px; cursor: pointer; }
.checkbox input, .radio input { margin-top: 5px; flex: none; accent-color: var(--accent); width: 16px; height: 16px; }
.checkbox-field { background: var(--accent-soft); padding: 12px 14px; border-radius: 8px; }
.section-heading-field { margin: 26px 0 8px; padding-top: 20px; border-top: 1px dashed var(--line); }
.section-heading-field input { max-width: 460px; font-family: 'Oswald', sans-serif; letter-spacing: .02em; }

.form-actions {
    position: sticky; bottom: 0; z-index: 10;
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 0; background: linear-gradient(transparent, var(--bg) 30%);
}
.form-actions .btn { min-width: 130px; }

/* ---------- Rich-text editor ---------- */

.rte { border: 1px solid #d8d3cc; border-radius: 8px; background: #fff; overflow: hidden; }
.rte:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(177, 151, 119, .2); }
.rte-toolbar { display: none; flex-wrap: wrap; gap: 4px; padding: 6px; background: #fbfaf8; border-bottom: 1px solid var(--line); }
.rte-toolbar button { font: inherit; font-size: 13px; padding: 5px 10px; border: 1px solid transparent; border-radius: 6px; background: none; cursor: pointer; color: var(--ink); }
.rte-toolbar button:hover { background: #fff; border-color: var(--line); }
.rte-toolbar button.is-on { background: var(--ink); color: #fff; }
.rte-sep { width: 1px; background: var(--line); margin: 3px 4px; }
.rte-area { display: none; min-height: 120px; max-height: 520px; overflow-y: auto; padding: 12px 16px; outline: none; color: var(--ink); }
.rte-area:empty::before { content: 'Type here…'; color: #aaa; }
.rte-area h3 { font-size: 18px; margin: 14px 0 6px; }
.rte-area p { margin: 0 0 10px; }
.rte-area ul, .rte-area ol { margin: 0 0 10px; padding-left: 24px; }
.rte-source { display: block; border: 0; border-radius: 0; min-height: 160px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.rte.is-ready .rte-toolbar { display: flex; }
.rte.is-ready .rte-area { display: block; }
.rte.is-ready .rte-source { display: none; }
.rte.is-ready.show-source .rte-area { display: none; }
.rte.is-ready.show-source .rte-source { display: block; }
.rte.is-ready.show-source .rte-toolbar button:not(.rte-source-btn) { opacity: .35; pointer-events: none; }

/* ---------- Filters ---------- */

.filters { display: grid; grid-template-columns: 2fr 1.4fr 1fr 1fr 1fr auto; gap: 12px; align-items: end; padding: 18px; }
.filters .field { margin: 0; }
.filters label { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: normal; }
.filter-buttons { display: flex; gap: 8px; }

/* ---------- Application detail ---------- */

.app-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.app-header h2 { margin: 0 0 4px; font-size: 26px; }
.app-header p { margin: 0; }
.app-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.app-side { position: sticky; top: 84px; }
.details { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.detail { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.detail dt { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.detail dd { margin: 2px 0 0; color: var(--ink); overflow-wrap: anywhere; }
.cover-letter { white-space: normal; overflow-wrap: anywhere; margin: 0; }

/* ---------- Auth pages ---------- */

.auth-page { display: flex; min-height: 100vh; background: linear-gradient(135deg, #f7f5f2 0%, #efe8de 100%); }
.auth-wrap { margin: auto; width: 100%; max-width: 460px; padding: 40px 16px; }
.auth-wrap:has(.auth-card-wide) { max-width: 640px; }
.auth-card { background: #fff; border-radius: 14px; box-shadow: 0 12px 40px rgba(39, 39, 39, .08); padding: 36px; }
.auth-logo { display: block; max-width: 170px; height: auto; margin: 0 auto 22px; }
.auth-card h1 { text-align: center; font-size: 24px; margin: 0 0 6px; }
.auth-card > .muted { text-align: center; margin: 0 0 22px; }

/* ---------- Confirm modal ---------- */

.modal { position: fixed; inset: 0; z-index: 100; background: rgba(20, 20, 20, .5); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-box { background: #fff; border-radius: 12px; max-width: 440px; width: 100%; padding: 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-box h2 { margin: 0 0 8px; font-size: 20px; }
.modal-box p { margin: 0 0 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }

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

/* ---------- Events, businesses (v2) ---------- */
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: #c0392b; color: #fff; font-size: 12px; text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.thumb-cell { display: flex; align-items: center; gap: 12px; }
.thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; background: #eee; }
.cover-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.cover-preview { width: 260px; max-width: 100%; border-radius: 8px; box-shadow: var(--shadow); }
.cover-row .field { flex: 1; min-width: 220px; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.photo-tile { margin: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.photo-tile img { display: block; width: 100%; height: 110px; object-fit: cover; }
.photo-tile figcaption { padding: 8px 10px 2px; font-size: 13px; }
.photo-tile .checkbox, .photo-tile .radio { margin-bottom: 6px; }
.photo-tile input { margin-top: 3px; }
.item-list { list-style: none; margin: 0 0 18px; padding: 0; }
.item-list li { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.item-list li > div { min-width: 0; }
.item-text { margin: 6px 0 0; white-space: normal; overflow-wrap: anywhere; }
.subform { border-top: 1px dashed var(--line); padding-top: 16px; }
.approve-panel { border: 1px solid #cfe0ef; background: var(--info-soft); }
.approve-panel p { margin-top: 0; }
.approve-actions { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.approve-actions form:first-child { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.approve-actions .checkbox { margin: 0; }
.error-log { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: #faf7f3; border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 360px; overflow: auto; }
.details.compact { grid-template-columns: 1fr; margin-bottom: 14px; }

@media (max-width: 1100px) {
    .filters { grid-template-columns: 1fr 1fr 1fr; }
    .filter-search { grid-column: 1 / -1; }
    .app-layout { grid-template-columns: 1fr; }
    .app-side { position: static; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .35); }
    .main { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 12px 16px; }
    .topbar-name { display: none; }
    .content { padding: 20px 16px 48px; }
    .grid-panels { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .stats { grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
    .stat { padding: 14px 12px; }
    .stat-value { font-size: 26px; }
    .stat-label { font-size: 12px; line-height: 1.3; }
    .grid-2, .details { grid-template-columns: 1fr; }
    .filters { grid-template-columns: 1fr 1fr; }
    .filter-buttons { grid-column: 1 / -1; }
    .filter-buttons .btn { flex: 1; }
    .panel { padding: 18px 16px; }
    .auth-card { padding: 26px 20px; }
    .toolbar .btn { width: 100%; }
    .tabs { width: 100%; flex-wrap: wrap; }
    .tabs a { flex: 1; text-align: center; padding: 8px 6px; }

    /* Tables become stacked cards */
    .table-cards thead { display: none; }
    .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
    .table-cards tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
    .table-cards td { padding: 4px 0; border: 0; display: flex; gap: 12px; justify-content: space-between; text-align: right; overflow-wrap: anywhere; }
    .table-cards td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; text-align: left; flex: none; padding-top: 2px; }
    .table-cards td:first-child { display: block; text-align: left; padding-bottom: 6px; }
    .table-cards td:first-child::before { display: none; }
    .table-cards td.actions { justify-content: flex-start; padding-top: 10px; }
    .table-cards td.actions::before { display: none; }
    .form-actions .btn { flex: 1; min-width: 0; }
}
