/**
 * demo-shared.css — Shared styles for all demo pages
 * Included by: demo-portal.php, demo-clinician-dashboard.php,
 *              demo-student-dashboard.php, demo-game.php
 *
 * Contains: sticky nav (all page variants), feedback widget, base styles
 */

/* ─── Base ────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    background: #0f0f1a; color: #e0e0e0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
}

/* ─── Sticky Nav (all page variants) ─────────────────── */
.dp-nav,              /* demo-portal */
.cd-nav,              /* clinician dashboard */
.sp-nav,              /* student dashboard */
.dp-game-nav {        /* game pages */
    position: sticky;
    top: 0;
    z-index: 100;
}

/* ─── User Avatar / Dropdown (shared across all pages) ── */
.nav-user {
    color: #8888aa; font-size: 13px;
    display: flex; align-items: center; gap: 8px;
    position: relative; cursor: pointer;
    padding: 4px 8px; border-radius: 6px; transition: background 0.15s;
}
.nav-user:hover { background: #2a2a3e; }
.nav-user strong { color: #ccc; }
.nav-avatar {
    width: 30px; height: 30px; border-radius: 50%;
    background: #2a3a5a; color: #7fbbea; display: flex;
    align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.nav-caret { font-size: 10px; color: #666; transition: transform 0.15s; }
.nav-user.open .nav-caret { transform: rotate(180deg); }
.nav-dropdown {
    display: none; position: absolute; top: 100%; right: 0; margin-top: 6px;
    background: #1a1a2e; border: 1px solid #2a2a3e; border-radius: 8px;
    min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    z-index: 100; overflow: hidden;
}
.nav-user.open .nav-dropdown { display: block; }
.nav-dropdown a, .nav-dropdown button {
    display: block; width: 100%; padding: 10px 16px; background: none;
    border: none; color: #ccc; font-size: 13px; text-align: left;
    cursor: pointer; text-decoration: none; transition: background 0.1s;
}
.nav-dropdown a:hover, .nav-dropdown button:hover { background: #1e1e32; color: #fff; }
.nav-dropdown .nav-divider { height: 1px; background: #2a2a3e; margin: 4px 0; }
.nav-dropdown .nav-signout { color: #aa6666; }
.nav-dropdown .nav-signout:hover { background: #2a1a1a; color: #ff6b6b; }
/* Game overlay variant — fixed position, not inside a nav bar */
.nav-user.nav-game-overlay {
    position: fixed; top: 12px; right: 12px; z-index: 50;
    background: rgba(15,15,26,0.7); backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.08); border-radius: 8px;
    padding: 4px 10px;
}
.nav-user.nav-game-overlay:hover { background: rgba(30,30,50,0.85); }
.nav-user.nav-game-overlay strong { font-size: 12px; }
.nav-user.nav-game-overlay .nav-avatar { width: 26px; height: 26px; font-size: 11px; }
@media (max-width: 600px) {
    .nav-user.nav-game-overlay strong { display: none; }
    .nav-user.nav-game-overlay .nav-caret { display: none; }
}

/* ─── Feedback Widget ────────────────────────────────── */
.dp-fb-btn {
    position: fixed; bottom: 24px; right: 24px; z-index: 500;
    width: 48px; height: 48px; border-radius: 50%;
    background: #4a90d9; color: #fff; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 12px rgba(74,144,217,0.4); transition: all 0.2s;
    font-size: 20px;
}
.dp-fb-btn:hover { transform: scale(1.1); background: #357abd; }
.dp-fb-panel {
    position: fixed; bottom: 84px; right: 24px; z-index: 500;
    width: 340px; background: #1a1a2e; border: 1px solid #2a2a3e;
    border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    overflow: hidden;
}
.dp-fb-header {
    padding: 14px 16px; background: #1e1e32; border-bottom: 1px solid #2a2a3e;
    font-size: 14px; font-weight: 600; color: #fff;
    display: flex; justify-content: space-between; align-items: center;
}
.dp-fb-close { background: none; border: none; color: #666; cursor: pointer; font-size: 18px; }
.dp-fb-close:hover { color: #fff; }
.dp-fb-body { padding: 16px; }
.dp-fb-body label { display: block; font-size: 12px; color: #8888aa; margin-bottom: 4px; margin-top: 12px; }
.dp-fb-body label:first-child { margin-top: 0; }
.dp-fb-body select, .dp-fb-body textarea {
    width: 100%; padding: 8px 10px; background: #0f0f1a; border: 1px solid #2a2a3e;
    border-radius: 6px; color: #e0e0e0; font-size: 13px; font-family: inherit;
    outline: none; transition: border-color 0.15s;
}
.dp-fb-body select:focus, .dp-fb-body textarea:focus { border-color: #4a90d9; }
.dp-fb-body textarea { min-height: 80px; resize: vertical; }
.dp-fb-stars { display: flex; gap: 4px; margin-top: 4px; }
.dp-fb-star {
    font-size: 22px; cursor: pointer; color: #333;
    transition: color 0.1s; background: none; border: none; padding: 2px;
}
.dp-fb-star.active { color: #ffd700; }
.dp-fb-star:hover { color: #ffd700; }
.dp-fb-submit {
    margin-top: 16px; width: 100%; padding: 10px; background: #4a90d9;
    color: #fff; border: none; border-radius: 6px; font-size: 13px;
    font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.dp-fb-submit:hover { background: #357abd; }
.dp-fb-submit:disabled { opacity: 0.4; cursor: not-allowed; }
.dp-fb-success { text-align: center; padding: 24px 16px; color: #66ff66; font-size: 14px; }

/* ─── Filter bar ─────────────────────────────────────── */
.dp-filter-bar {
    display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px;
}
.dp-filter-btn {
    padding: 5px 14px; border-radius: 16px; border: 1px solid #2a2a3e;
    background: transparent; color: #8888aa; font-size: 12px; cursor: pointer;
    transition: all 0.15s; white-space: nowrap;
}
.dp-filter-btn:hover { border-color: #4a90d9; color: #ccc; }
.dp-filter-btn.active { background: #4a90d9; border-color: #4a90d9; color: #fff; }

/* ─── Scrollable table ───────────────────────────────── */
.dp-table-scroll {
    max-height: 380px; overflow-y: auto; border: 1px solid #1f1f35;
    border-radius: 8px; background: rgba(0,0,0,0.15);
}
.dp-table-scroll::-webkit-scrollbar { width: 6px; }
.dp-table-scroll::-webkit-scrollbar-track { background: transparent; }
.dp-table-scroll::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ─── Table header ───────────────────────────────────── */
.dp-table-header {
    display: grid;
    grid-template-columns: minmax(120px, 1.5fr) 50px 60px 80px 100px 20px;
    align-items: center; padding: 6px 12px; gap: 6px;
    font-size: 10px; color: #666; text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid #1f1f35;
}
@media (max-width: 600px) {
    .dp-table-header { grid-template-columns: 1fr auto auto; }
    .dp-table-header .dp-col-levels,
    .dp-table-header .dp-col-acc { display: none; }
}

/* ─── Session table rows (grid columns) ──────────────── */
.dp-session-item { border-bottom: 1px solid #1f1f35; padding: 0 12px; }
.dp-session-item:last-child { border-bottom: none; }
.dp-session-item.open { background: rgba(255,255,255,0.02); }
.dp-session-row {
    display: grid;
    grid-template-columns: minmax(120px, 1.5fr) 50px 60px 80px 100px 20px;
    align-items: center; padding: 9px 0; gap: 6px; cursor: pointer;
}
@media (max-width: 600px) {
    .dp-session-row { grid-template-columns: 1fr auto auto; }
    .dp-session-row .dp-col-levels,
    .dp-session-row .dp-col-acc { display: none; }
}
.dp-session-game { font-weight: 500; font-size: 13px; color: #e0e0e0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dp-session-duration {
    font-size: 11px; color: #88aa88; background: #1a2a1a;
    padding: 2px 6px; border-radius: 4px; white-space: nowrap; text-align: center;
}
.dp-session-stat {
    font-size: 11px; color: #8888cc; background: #1a1a2e;
    padding: 2px 6px; border-radius: 4px; white-space: nowrap; text-align: center;
}
.dp-session-date { color: #8888aa; font-size: 11px; white-space: nowrap; text-align: right; }
.dp-session-chevron { color: #555; font-size: 10px; text-align: center; }

/* ─── Expanded detail ────────────────────────────────── */
.dp-session-detail { padding: 0 0 12px 0; }
.dp-detail-grid {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    background: rgba(255,255,255,0.03); border-radius: 6px; padding: 10px 12px;
}
.dp-detail-item { display: flex; flex-direction: column; gap: 2px; }
.dp-detail-label { font-size: 11px; color: #666; text-transform: uppercase; letter-spacing: 0.5px; }
.dp-detail-value { font-size: 13px; color: #ccc; }
.dp-detail-note { grid-column: 1 / -1; font-size: 12px; color: #555; font-style: italic; }

/* ─── Chart ──────────────────────────────────────────── */
.dp-chart-wrap {
    margin-top: 16px; padding: 12px; background: rgba(0,0,0,0.15);
    border: 1px solid #1f1f35; border-radius: 8px;
}
.dp-chart-title { font-size: 12px; color: #8888aa; margin-bottom: 8px; text-align: center; }
.dp-chart-svg { width: 100%; height: auto; display: block; }
.dp-chart-legend {
    display: flex; gap: 16px; justify-content: center; margin-top: 8px; flex-wrap: wrap;
}
.dp-chart-legend-item {
    display: flex; align-items: center; gap: 5px; font-size: 11px; color: #8888aa;
}
.dp-chart-legend-dot {
    width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}

/* ─── Feedback table rows ────────────────────────────── */
.dp-fb-row {
    display: grid;
    grid-template-columns: minmax(100px, 1.2fr) 70px 50px 1fr 100px;
    align-items: start; padding: 10px 12px; gap: 8px;
    border-bottom: 1px solid #1f1f35;
}
.dp-fb-row:last-child { border-bottom: none; }
@media (max-width: 600px) {
    .dp-fb-row { grid-template-columns: 1fr auto; }
    .dp-fb-row .dp-col-type,
    .dp-fb-row .dp-col-rating { display: none; }
}

/* ─── Misc shared ────────────────────────────────────── */
.dp-empty { text-align: center; padding: 32px 20px; color: #666; font-size: 14px; }
.dp-loading { text-align: center; padding: 32px; color: #8888aa; font-size: 14px; }
