html, body {
    margin: 0;
    height: 100%;
}

body {
    font-family: "Plus Jakarta Sans", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    color: #0f172a;
}

#app {
    height: 100%;
}

.mud-appbar {
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    background-color: #ffffff !important;
    color: #0f172a;
}

.mud-drawer {
    border-right: 1px solid rgba(15, 23, 42, 0.08);
}

.mud-paper {
    border-radius: 12px;
}

/* ─── Login layout wrapper ─── */
.login-page-wrapper {
    min-height: 100svh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

/* ─── Step badges in wizard sections ─── */
.step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--mud-palette-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}

/* ─── AI Edit Mode badge ─── */
.ai-mode-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

/* ─── AI generate button accent ─── */
.mud-button.btn-ai {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    color: #fff !important;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.35) !important;
}

.mud-button.btn-ai:hover:not(:disabled) {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.45) !important;
}

/* ─── Question card left-border states ─── */
.question-done {
    border-left: 3px solid #22c55e !important;
}

.question-pending {
    border-left: 3px solid #cbd5e1 !important;
}

/* ─── Dashboard stat card ─── */
.stat-card {
    position: relative;
    overflow: hidden;
}

.stat-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    flex-shrink: 0;
}

/* ─── Quiz thumbnail in lists ─── */
.quiz-thumb {
    width: 44px;
    height: 44px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.quiz-thumb-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e0e7ff 0%, #f3e8ff 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* ─── Image preview ─── */
.img-preview {
    border-radius: 10px;
    overflow: hidden;
    display: inline-block;
    border: 1px solid rgba(15, 23, 42, 0.08);
    max-width: 100%;
}

/* ─── Sticky save bar ─── */
.sticky-save-bar {
    position: sticky;
    bottom: 0;
    z-index: 100;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    padding: 12px 16px;
    margin: 0 -4px;
    border-radius: 0;
}

/* ─── Home nav cards ─── */
.home-nav-card {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    text-decoration: none;
    display: block;
}

.home-nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10) !important;
}

/* ─── Mobile touch targets & spacing ─── */
@media (max-width: 599.98px) {
    .mud-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Ensure action buttons are tappable */
    .mud-button-root {
        min-height: 40px;
    }

    .mud-icon-button {
        width: 44px !important;
        height: 44px !important;
    }

    /* Full-width action buttons on mobile */
    .mobile-full-btn {
        width: 100% !important;
    }
}

/* ─── Blazor error UI ─── */
#blazor-error-ui {
    background: rgba(15, 23, 42, 0.96);
    color: #f8fafc;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: min(52rem, calc(100vw - 2rem));
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
    display: none;
    padding: 0.7rem 1.2rem;
    position: fixed;
    z-index: 2000;
}

#blazor-error-ui .reload {
    color: #93c5fd;
    text-decoration: none;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* ─── Loading progress ─── */
.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto;
}

.loading-progress circle {
    fill: none;
    stroke: rgba(15, 23, 42, 0.14);
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #0ea5e9;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}
