/* ══════════════════════════════════════════════
   AUTO-QUIZ — UPLOAD CSS
   Upload screen, drop zone, file chip, quiz selection,
   generate button, disclaimer, and error message toast.
   ══════════════════════════════════════════════ */

/* ── UPLOAD SCREEN ── */
#upload-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    padding: 20px 16px;
    box-sizing: border-box;
    gap: 0;
}

/* ── UPLOAD ZONE ── */
.upload-zone {
    width: min(420px, 100%);
    border: 1.5px dashed rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 38px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    background: #121214;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.upload-zone:hover {
    border-color: rgba(255, 255, 255, 0.22);
}

.upload-zone.drag-active {
    border-color: var(--blue);
    background: rgba(83, 100, 253, 0.06);
}

.upload-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
}

.upload-text h3 {
    font-size: clamp(0.95rem, 4vw, 1.05rem);
    font-weight: 600;
    color: var(--text-dark);
    font-family: "Poppins", sans-serif;
}

.upload-text p {
    font-size: clamp(0.78rem, 3vw, 0.84rem);
    color: var(--text-soft);
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: "Poppins", sans-serif;
    font-weight: 500;
    font-size: clamp(0.85rem, 3.5vw, 0.92rem);
    transition: opacity 0.15s ease, transform 0.1s ease;
}

.upload-btn svg {
    flex-shrink: 0;
    stroke-width: 2.75;
}

.upload-btn:hover {
    opacity: 0.9;
}

.upload-btn:active,
.upload-btn.pressed {
    background-color: var(--blue-dark);
    transform: scale(0.97);
}

#file-input {
    display: none;
}

/* ── FILE CHIP ── */
.file-chip {
    display: none;
    flex-direction: row;
    width: min(420px, 100%);
    justify-content: space-between;
    align-items: center;
    border: 1.5px solid var(--border);
    border-radius: 50px;
    padding: 10px 16px;
    margin-top: 16px;
    font-size: clamp(0.78rem, 3.5vw, 0.92rem);
    background: #121214;
}

.file-chip p {
    font-weight: 400;
    color: var(--text-soft);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
    margin: 0;
    font-family: "Poppins", sans-serif;
}

.remove-file-btn {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 8px;
    padding: 2px;
    transition: transform 0.1s ease;
}

.remove-file-btn:hover {
    transform: scale(1.1);
}

/* ── QUIZ SELECTION ── */
.quiz-selection {
    width: min(420px, 100%);
    margin-top: 20px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    gap: 10px;
}

.quiz-selection h6 {
    font-size: clamp(0.6rem, 3vw, 0.75rem);
    font-family: "Poppins", sans-serif;
    font-weight: 400;
    color: var(--text-soft);
    margin-left: 4px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.quiz-type-wrapper {
    display: flex;
    width: 100%;
    flex-direction: row;
    gap: 10px;
}

.quiz-type {
    padding: 13px 12px;
    width: 100%;
    background-color: transparent;
    border: 0.5px solid oklch(26.033% 0.00003 271.152);
    border-radius: 14px;
    font-family: "Poppins", sans-serif;
    font-weight: 500;
    font-size: clamp(0.78rem, 3vw, 0.88rem);
    cursor: pointer;
    color: var(--text-soft);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.quiz-type:hover {
    border-color: none;
    color: var(--text-mid);
}

.quiz-type:focus,
.quiz-type.active {
    border-color: none;
    background-color: rgb(62, 114, 255);
    color: #ffffff;
}

.quiz-type:active {
    transform: scale(0.94);
}

.quiz-type.enum,
.quiz-type.iden {
    display: none;
}

/* ── GENERATE BUTTON ── */
.generate-quiz {
    display: flex;
    justify-content: center;
    align-items: center;
    width: min(420px, 100%);
    margin-top: 28px;
    padding: 15px;
    background: var(--gradient);
    border: none;
    color: white;
    border-radius: 50px;
    font-family: "Poppins", sans-serif;
    font-weight: 500;
    font-size: clamp(0.9rem, 4vw, 1.05rem);
    cursor: pointer;
    transition: transform 0.2s ease;
    text-align: center;
}

.generate-quiz:active {
    transform: scale(0.96);
}

.generate-quiz:disabled,
.generate-quiz.btn-disabled-quota {
    filter: grayscale(0.85);
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
    transform: none;
}

/* ── DAILY QUOTA BADGE ── */
.quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px;
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 9999px;
    font-size: clamp(0.72rem, 3.2vw, 0.82rem);
    font-weight: 500;
    color: var(--text-soft, #a1a1aa);
    letter-spacing: 0.2px;
    transition: all 0.25s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.quota-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    flex-shrink: 0;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
    transition: background 0.25s ease, box-shadow 0.25s ease;
}

.quota-badge--warning .quota-badge-dot {
    background: #f59e0b;
    box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.quota-badge--exhausted {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.quota-badge--exhausted .quota-badge-dot {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.quota-badge--custom {
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.3);
    color: #d8b4fe;
}

.quota-badge--custom .quota-badge-dot {
    background: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

/* ── ERROR MESSAGE ── */
/* Fixed toast so it floats above both the upload screen and the live quiz */
.error-message {
    position: fixed;
    top: 72px; /* clear the header */
    left: 50%;
    transform: translateX(-50%);
    width: min(420px, calc(100% - 32px));
    z-index: 9999;
    padding: 14px 16px;
    border-radius: 16px;
    background: #121214;
    border: 0.5px solid var(--border);
    font-size: clamp(0.72rem, 3vw, 0.82rem);
    font-family: "Poppins", sans-serif;
    font-weight: 400;
    color: var(--text-dark);
    line-height: 1.45;
    animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.error-retry-btn {
    flex-shrink: 0;
    padding: 6px 14px;
    border-radius: 999px;
    border: 0.5px solid var(--border);
    background: #1e1e22;
    color: var(--text-dark);
    font-family: "Poppins", sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.error-retry-btn:hover {
    background: #2a2a30;
}

.error-close-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-dark);
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s ease, background 0.15s ease;
    line-height: 1;
}

.error-close-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(6px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* ── RESPONSIVE ── */
@media (max-width: 500px) {
    .quiz-type-wrapper {
        flex-direction: column;
    }
}

/* ── LIVE MCQ VIEW ──
   MCQ-Quiz.css's .quiz-main assumes it's the only thing in <body> (100dvh,
   no page header above it). Pin it over the whole viewport here too, so it
   matches how it looks on the real MCQ-Quiz.html once we hand off. */
#live-quiz-main {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
}

html.has-saved-quiz #upload-screen,
html.has-saved-quiz #loading-overlay {
    display: none;
}

html.has-saved-quiz #live-quiz-main {
    display: flex;
}

/* Small status line shown while waiting for the next question to finish streaming in */
.live-waiting-label {
    text-align: center;
    font-size: 13px;
    opacity: 0.6;
    margin-top: 10px;
}

/* ── NOTIFY ME BAR ── */
/* Fixed pill at the bottom of the screen, shown while generation is running.  */
/* Hidden by default — JS adds .notify-bar--visible to show it.                */
#notify-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #1c1c20;
    border: 1px solid var(--border);
    border-radius: 50px;
    padding: 8px 8px 8px 20px;
    width: min(420px, calc(100% - 32px));
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.5);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.28s ease, transform 0.32s cubic-bezier(0.34, 1.3, 0.64, 1), visibility 0.28s;
    will-change: transform, opacity;
}

#notify-bar.notify-bar--visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

#notify-bar-text {
    font-size: clamp(0.74rem, 3vw, 0.86rem);
    color: var(--text-soft);
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

#notify-bar-btn {
    background: var(--blue);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 11px 22px;
    font-family: "Poppins", sans-serif;
    font-weight: 500;
    font-size: clamp(0.82rem, 3vw, 0.9rem);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.1s ease;
    touch-action: manipulation;
    white-space: nowrap;
}

#notify-bar-btn:active {
    transform: scale(0.94);
    background: var(--blue-dark);
}

/* State: permission granted */
#notify-bar.notify-bar--granted #notify-bar-text {
    color: var(--text-mid);
}

#notify-bar.notify-bar--granted #notify-bar-btn {
    background: #1e3a2a;
    color: #4ade80;
    pointer-events: none;
    cursor: default;
}

/* State: permission denied */
#notify-bar.notify-bar--denied #notify-bar-btn {
    background: #2a1e1e;
    color: #f87171;
    pointer-events: none;
    cursor: default;
    font-size: clamp(0.72rem, 2.5vw, 0.8rem);
}