/* ==================================================================
   quiz-library.css — Admin Quiz Library page
   Loaded after styles.css + library.css + player.css + simulator.css.
   The clip cards reuse `.sim-card` and inherit `body.sim-page #simPanel`
   styling so they are byte-for-byte identical to the simulator's cards.
   ================================================================== */

/* ── Top-bar admin pill ─────────────────────────────────────────── */
.ql-admin-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 6px;
    border-radius: 999px;
    background: linear-gradient(135deg, #fff5dd 0%, #ffe7b3 100%);
    border: 1px solid #f1d28a;
    color: #7a5400;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: 1.2px;
    margin-left: 4px;
    line-height: 1;
}

/* ── Hero section ──────────────────────────────────────────────── */
.ql-hero {
    padding: 22px 28px 0;
}

.ql-hero-inner {
    background: linear-gradient(135deg, #ffffff 0%, #f4f7fc 70%, #eaf3f6 100%);
    border: 1px solid #e0e7ef;
    border-radius: 18px;
    padding: 22px 24px;
    display: flex;
    align-items: stretch;
    gap: 28px;
    flex-wrap: wrap;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.9) inset,
        0 8px 24px -16px rgba(38,64,139,0.18);
    position: relative;
    overflow: hidden;
}

.ql-hero-inner::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(166,207,213,0.22) 0%, transparent 65%);
    pointer-events: none;
}

.ql-hero-text {
    flex: 1 1 360px;
    min-width: 0;
    position: relative;
    z-index: 1;
}

.ql-hero-eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 2px;
    color: #26408b;
    margin-bottom: 6px;
    opacity: 0.78;
}

.ql-hero-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.7rem;
    font-weight: 800;
    color: #181c1f;
    letter-spacing: -0.6px;
    margin: 0 0 4px;
    line-height: 1.1;
}

.ql-hero-sub {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.55;
    color: #5a6573;
    max-width: 56ch;
}

/* Stat cluster */
.ql-hero-stats {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 4px 4px 4px 18px;
    border-left: 1px solid rgba(38,64,139,0.10);
    position: relative;
    z-index: 1;
}

.ql-hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    min-width: 52px;
}

.ql-hero-stat-num {
    font-size: 1.65rem;
    font-weight: 800;
    color: #181c1f;
    letter-spacing: -0.5px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}
.ql-hero-stat-num-ok   { color: #2e7d52; }
.ql-hero-stat-num-warn { color: #c77800; }

.ql-hero-stat-lbl {
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 1.4px;
    color: #707882;
    text-transform: uppercase;
    margin-top: 4px;
}

.ql-hero-stat-divider {
    width: 1px;
    height: 28px;
    background: rgba(38,64,139,0.10);
    align-self: center;
}

/* ── Status banner ─────────────────────────────────────────────── */
.ql-status {
    margin: 14px 28px -2px;
    font-size: 0.85rem;
    padding: 9px 14px;
    background: #f1f4f8;
    border: 1px solid #e0e7ef;
    border-radius: 10px;
    color: #404750;
}
.ql-status-error {
    background: #fdecec;
    border-color: rgba(186,26,26,0.22);
    color: #ba1a1a;
}

/* ── Clip-cards panel (overrides body.sim-page #simPanel padding) ── */
.ql-panel {
    padding: 20px 28px 60px !important;
    margin-top: 6px !important;
}

.ql-panel-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e8eaee;
}

.ql-panel .sim-mode-label {
    font-size: 11px !important;
    font-weight: 800;
    letter-spacing: 2px;
    color: #26408b !important;
}

/* ── Card status pill (replaces simulator's "▶ PLAY" hint) ─────── */
.ql-card-status {
    display: inline-flex;
    align-items: center;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.7px;
    border-radius: 100px;
    padding: 2.5px 8px;
    text-transform: uppercase;
    white-space: nowrap;
}
.ql-card-status-ok {
    background: rgba(46,125,82,0.10);
    color: #2e7d52;
    border: 1px solid rgba(46,125,82,0.18);
}
.ql-card-status-empty {
    background: #f1f4f8;
    color: #9ea6b0;
    border: 1px dashed #c7cfd9;
}

/* Card cursor — quiz-library cards open the edit dialog */
body.sim-page #simPanel .sim-card { cursor: pointer; }

/* ── Empty state ───────────────────────────────────────────────── */
.ql-empty {
    margin: 40px auto 80px;
    max-width: 520px;
    padding: 48px 32px;
    background: #fff;
    border: 1px solid #e0e7ef;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 8px 24px -16px rgba(38,64,139,0.12);
}

.ql-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #eaf3f6 0%, #d9e8ec 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.ql-empty-icon .material-symbols-outlined {
    font-size: 36px;
    color: #26408b;
}

.ql-empty-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #181c1f;
    margin: 0 0 8px;
    letter-spacing: -0.3px;
}

.ql-empty-msg {
    margin: 0 0 22px;
    font-size: 0.9rem;
    color: #5a6573;
    line-height: 1.55;
}

.ql-empty-pill {
    display: inline-flex;
    align-items: center;
    background: #eef2f8;
    border: 1px solid #d6dde9;
    color: #26408b;
    font-weight: 700;
    font-size: 0.78rem;
    border-radius: 6px;
    padding: 1px 7px;
    margin: 0 2px;
    white-space: nowrap;
}

.ql-empty-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 11px;
    background: #26408b;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 14px -6px rgba(38,64,139,0.4);
}
.ql-empty-cta:hover {
    background: #1c3070;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px -6px rgba(38,64,139,0.5);
}

/* ── Edit Defaults Dialog ──────────────────────────────────────── */
.ql-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(13,2,33,0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 24px;
    animation: qlDialogFadeIn 0.18s ease;
}
.ql-dialog-overlay[hidden] { display: none !important; }

@keyframes qlDialogFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.ql-dialog {
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 30px 80px -20px rgba(13,2,33,0.55);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: qlDialogPop 0.22s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes qlDialogPop {
    from { opacity: 0; transform: scale(0.94) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.ql-dialog-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px 22px 18px;
    border-bottom: 1px solid #f1f4f8;
    background: linear-gradient(180deg, #fafbfd 0%, #ffffff 100%);
}

.ql-dialog-header-icon {
    width: 40px;
    height: 40px;
    border-radius: 11px;
    background: linear-gradient(135deg, #26408b 0%, #1c3070 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 14px -4px rgba(38,64,139,0.5);
}
.ql-dialog-header-icon .material-symbols-outlined {
    font-size: 22px;
    font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24;
}

.ql-dialog-header-text {
    flex: 1;
    min-width: 0;
}

.ql-dialog-eyebrow {
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.6px;
    color: #26408b;
    opacity: 0.7;
    margin-bottom: 3px;
}

.ql-dialog-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #181c1f;
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.ql-dialog-subtitle {
    margin-top: 4px;
    font-size: 0.85rem;
    color: #5a6573;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ql-dialog-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: #9ea6b0;
    display: flex;
    align-items: center;
    transition: background 0.12s, color 0.12s;
    flex-shrink: 0;
    margin: -4px -4px 0 0;
}
.ql-dialog-close:hover { background: #f1f4f8; color: #181c1f; }
.ql-dialog-close .material-symbols-outlined { font-size: 20px; }

.ql-dialog-body {
    padding: 18px 22px 8px;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Live ECG strip preview at the top of the dialog */
.ql-edit-preview-wrap {
    background: #fff8e6;
    border: 1px solid #f1e0bb;
    border-radius: 11px;
    padding: 10px 12px 8px;
    box-shadow: 0 1px 0 rgba(255,255,255,0.6) inset;
}

.ql-edit-preview-canvas {
    width: 100%;
    height: 84px;
    display: block;
    border-radius: 6px;
}

.ql-edit-preview-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    color: #6b5a2c;
    text-transform: uppercase;
}
.ql-edit-preview-bpm {
    color: #26408b;
    font-variant-numeric: tabular-nums;
}
.ql-edit-preview-dot { color: #c0c7d2; }

.ql-field-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: #404750;
    letter-spacing: 0.2px;
    margin: 4px 0 -6px;
    display: flex;
    align-items: baseline;
    gap: 6px;
}

.ql-field-hint {
    font-size: 0.72rem;
    color: #9ea6b0;
    font-weight: 500;
    letter-spacing: 0;
}

.ql-field-input {
    width: 100%;
    border: 1px solid #d9dee6;
    border-radius: 9px;
    padding: 9px 12px;
    font-size: 0.9rem;
    font-family: inherit;
    color: #181c1f;
    outline: none;
    background: #fbfcfd;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}
.ql-field-input:focus {
    border-color: #26408b;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(38,64,139,0.08);
}
.ql-field-input::placeholder { color: #c0c7d2; }

.ql-field-textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
}

/* Choices */
.ql-choices {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ql-choice-row {
    display: flex;
    align-items: center;
    gap: 9px;
}

.ql-choice-radio {
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}
.ql-choice-radio input[type="radio"] { display: none; }

.ql-choice-dot {
    width: 18px;
    height: 18px;
    border: 2px solid #c7cfd9;
    border-radius: 50%;
    background: #fff;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    display: block;
    box-sizing: border-box;
    position: relative;
}
.ql-choice-radio:hover .ql-choice-dot { border-color: #2e7d52; }
.ql-choice-radio input[type="radio"]:checked + .ql-choice-dot {
    border-color: #2e7d52;
    background: #2e7d52;
    box-shadow: 0 0 0 3px rgba(46,125,82,0.15);
}
.ql-choice-radio input[type="radio"]:checked + .ql-choice-dot::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.ql-choice-letter {
    width: 16px;
    font-size: 0.76rem;
    font-weight: 800;
    color: #9ea6b0;
    text-align: center;
    flex-shrink: 0;
}

.ql-choice-row .ql-field-input { flex: 1; min-width: 0; }

/* Footer */
.ql-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 22px 18px;
    border-top: 1px solid #f1f4f8;
    background: #fafbfd;
}

.ql-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.15s, transform 0.1s, box-shadow 0.15s, border-color 0.15s;
    font-family: inherit;
}
.ql-btn:active { transform: translateY(1px); }
.ql-btn:disabled { opacity: 0.55; cursor: default; }

.ql-btn-secondary {
    background: #fff;
    border-color: #d9dee6;
    color: #404750;
}
.ql-btn-secondary:hover:not(:disabled) {
    background: #f7fafe;
    border-color: #c0c7d2;
}

.ql-btn-primary {
    background: #26408b;
    color: #fff;
    box-shadow: 0 4px 14px -6px rgba(38,64,139,0.5);
}
.ql-btn-primary:hover:not(:disabled) {
    background: #1c3070;
    box-shadow: 0 6px 18px -6px rgba(38,64,139,0.6);
}

/* topbar-search styles inherited from styles.css */
