/* ─────────────────────────────────────────────
   Layout
───────────────────────────────────────────── */
.sidebar-container {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100vh !important;
    width: 224px !important;
    z-index: 1000 !important;
    display: flex !important;
}

.main-content-wrapper {
    margin-left: 224px !important;
    width: calc(100% - 224px) !important;
    height: 100vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .sidebar-container { width: 100% !important; }
    .main-content-wrapper { margin-left: 0 !important; width: 100% !important; }
}

/* ─────────────────────────────────────────────
   Page
───────────────────────────────────────────── */
.hw-page {
    background: #fafafa;
    min-height: 100vh;
    padding: 2rem 1.5rem 4rem;
}

.hw-container {
    max-width: 680px;
    margin: 0 auto;
}

/* ─────────────────────────────────────────────
   Page header
───────────────────────────────────────────── */
.hw-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #09090b;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.hw-page-desc {
    font-size: 0.875rem;
    color: #71717a;
    margin-top: 0.3rem;
}

/* ─────────────────────────────────────────────
   Card
───────────────────────────────────────────── */
.hw-card {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    overflow: hidden;
}

.hw-card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e4e4e7;
}

.hw-card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #09090b;
}

.hw-card-subtitle {
    font-size: 0.8125rem;
    color: #71717a;
    margin-top: 0.2rem;
}

.hw-card-body {
    padding: 1.5rem;
}

/* ─────────────────────────────────────────────
   Field label
───────────────────────────────────────────── */
.field-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #3f3f46;
    margin-bottom: 0.5rem;
}

/* ─────────────────────────────────────────────
   Inputs
───────────────────────────────────────────── */
.hw-input {
    width: 100%;
    padding: 0.5625rem 0.875rem 0.5625rem 2.4rem;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    font-size: 0.875rem;
    color: #09090b;
    background: #ffffff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.hw-input:focus {
    border-color: #a1a1aa;
    box-shadow: 0 0 0 3px rgba(161, 161, 170, 0.2);
}

.hw-input::placeholder { color: #a1a1aa; }

.input-wrap { position: relative; }

.input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #a1a1aa;
    font-size: 0.8125rem;
    pointer-events: none;
}


/* ─────────────────────────────────────────────
   Stepper
───────────────────────────────────────────── */
.stepper-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 6px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    font-size: 1rem;
    font-weight: 600;
    color: #3f3f46;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.12s;
    flex-shrink: 0;
    font-family: inherit;
}

.stepper-btn:hover {
    border-color: #a1a1aa;
    background: #f4f4f5;
    color: #09090b;
}

.stepper-count {
    font-size: 1.125rem;
    font-weight: 700;
    color: #09090b;
    min-width: 2rem;
    text-align: center;
}

/* ─────────────────────────────────────────────
   Select
───────────────────────────────────────────── */
.hw-select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.25rem;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2371717a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
}

/* ─────────────────────────────────────────────
   Toggle labels
───────────────────────────────────────────── */
.hw-toggle-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #09090b;
}

.hw-toggle-hint {
    font-size: 0.75rem;
    color: #71717a;
}

/* ─────────────────────────────────────────────
   Toggle
───────────────────────────────────────────── */
.toggle-track {
    position: relative;
    width: 2.75rem;
    height: 1.375rem;
    border-radius: 9999px;
    background: #e4e4e7;
    cursor: pointer;
    transition: background 0.2s;
    flex-shrink: 0;
}

.toggle-track.on { background: #18181b; }

.toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.0625rem;
    height: 1.0625rem;
    border-radius: 50%;
    background: white;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}

.toggle-track.on .toggle-thumb { transform: translateX(1.375rem); }

/* ─────────────────────────────────────────────
   Tabs
───────────────────────────────────────────── */
.hw-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #e4e4e7;
    margin-bottom: 1.25rem;
}

.tab-pill {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #71717a;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: all 0.12s;
    font-family: inherit;
}

.tab-pill.active {
    color: #09090b;
    border-bottom-color: #09090b;
}

.tab-pill.inactive:hover {
    color: #3f3f46;
    background: #f4f4f5;
}

/* ─────────────────────────────────────────────
   Primary button
───────────────────────────────────────────── */
.generate-btn {
    width: 100%;
    padding: 0.625rem 1.25rem;
    background: #09090b;
    color: #fafafa;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
    letter-spacing: 0.01em;
}

.generate-btn:hover { background: #27272a; }
.generate-btn:active { background: #3f3f46; }
.generate-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─────────────────────────────────────────────
   Action buttons (results bar)
───────────────────────────────────────────── */
.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid #e4e4e7;
    background: #ffffff;
    color: #3f3f46;
    cursor: pointer;
    transition: all 0.12s;
    font-family: inherit;
}

.action-btn:hover {
    background: #f4f4f5;
    border-color: #a1a1aa;
    color: #09090b;
}

.action-btn-primary {
    background: #09090b;
    color: #fafafa;
    border-color: #09090b;
}

.action-btn-primary:hover {
    background: #27272a;
    border-color: #27272a;
    color: #fafafa;
}

/* ─────────────────────────────────────────────
   Question cards
───────────────────────────────────────────── */
.question-card {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 1.25rem;
}

.question-meta {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    margin-bottom: 0.875rem;
}

.question-num {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    color: #71717a;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 4px;
    padding: 0.1rem 0.4rem;
    margin-top: 0.1rem;
}

.question-text {
    font-size: 0.9375rem;
    font-weight: 500;
    color: #09090b;
    line-height: 1.5;
}

/* ─────────────────────────────────────────────
   Option buttons
───────────────────────────────────────────── */
.option-btn {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.5625rem 0.875rem;
    border: 1px solid #e4e4e7;
    border-radius: 7px;
    background: #ffffff;
    text-align: left;
    cursor: pointer;
    transition: all 0.12s;
    font-size: 0.875rem;
    color: #3f3f46;
    font-family: inherit;
}

.option-btn:hover {
    border-color: #a1a1aa;
    background: #fafafa;
    color: #09090b;
}

.option-btn.correct  { border-color: #16a34a; background: #f0fdf4; color: #15803d; }
.option-btn.wrong    { border-color: #dc2626; background: #fef2f2; color: #dc2626; }
.option-btn.revealed { border-color: #16a34a; background: #f0fdf4; color: #15803d; }

.option-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 4px;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    color: #52525b;
    font-weight: 600;
    font-size: 0.75rem;
    flex-shrink: 0;
    margin-right: 0.625rem;
}

.option-btn.correct .option-letter,
.option-btn.revealed .option-letter { background: #dcfce7; border-color: #86efac; color: #15803d; }
.option-btn.wrong .option-letter    { background: #fee2e2; border-color: #fca5a5; color: #dc2626; }

/* ─────────────────────────────────────────────
   Explanation box
───────────────────────────────────────────── */
.explanation {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 7px;
    font-size: 0.8125rem;
    color: #3f3f46;
    line-height: 1.55;
}

/* ─────────────────────────────────────────────
   Results bar
───────────────────────────────────────────── */
.results-bar {
    background: #ffffff;
    border: 1px solid #e4e4e7;
    border-radius: 10px;
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.results-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #09090b;
}

.results-subtitle {
    font-size: 0.8125rem;
    color: #71717a;
    margin-top: 0.1rem;
}

/* ─────────────────────────────────────────────
   Session / history cards
───────────────────────────────────────────── */
.session-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border: 1px solid #e4e4e7;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.12s;
}

.session-card:hover {
    border-color: #a1a1aa;
    background: #fafafa;
}

/* ─────────────────────────────────────────────
   Divider
───────────────────────────────────────────── */
.hw-divider {
    border: none;
    border-top: 1px solid #e4e4e7;
    margin: 0;
}

/* ─────────────────────────────────────────────
   Badge
───────────────────────────────────────────── */
.hw-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #52525b;
    background: #f4f4f5;
    border: 1px solid #e4e4e7;
    border-radius: 9999px;
    padding: 0.2rem 0.6rem;
}


/* ─────────────────────────────────────────────
   Loading overlay
───────────────────────────────────────────── */
.loading {
    background: rgba(244, 244, 245, 0.78);
    backdrop-filter: blur(12px);
}

.loading-content.hw-loading-card {
    width: min(92vw, 22rem);
    padding: 2rem 1.75rem 1.6rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(228, 228, 231, 0.92);
    background:
        radial-gradient(circle at top, rgba(255, 255, 255, 0.98), rgba(250, 250, 250, 0.98) 62%),
        linear-gradient(180deg, #ffffff 0%, #f4f4f5 100%);
    box-shadow:
        0 30px 80px rgba(24, 24, 27, 0.14),
        0 8px 20px rgba(24, 24, 27, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.85rem;
}

.hw-loader {
    position: relative;
    width: 9.5rem;
    height: 7.5rem;
    margin-bottom: 0.15rem;
}

.hw-loader-sheet {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6.25rem;
    height: 7.5rem;
    border-radius: 1.1rem;
    border: 1px solid #e4e4e7;
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    box-shadow: 0 12px 24px rgba(24, 24, 27, 0.08);
}

.hw-loader-sheet-back {
    transform: translate(-50%, -50%) rotate(-11deg) translateY(0.4rem);
    background: linear-gradient(180deg, #f5f5f5 0%, #e4e4e7 100%);
    animation: hw-sheet-back 1.8s ease-in-out infinite;
}

.hw-loader-sheet-mid {
    transform: translate(-50%, -50%) rotate(-4deg) translateX(-0.15rem);
    background: linear-gradient(180deg, #ffffff 0%, #f4f4f5 100%);
    animation: hw-sheet-mid 1.8s ease-in-out infinite;
}

.hw-loader-sheet-front {
    transform: translate(-50%, -50%) rotate(3deg) translateX(0.2rem);
    overflow: hidden;
    animation: hw-sheet-front 1.8s ease-in-out infinite;
}

.hw-loader-sheet-front span {
    display: block;
    height: 0.44rem;
    margin: 1rem 0.9rem 0;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(24, 24, 27, 0.18) 0 68%, rgba(24, 24, 27, 0.05) 68% 100%);
    transform-origin: left center;
    animation: hw-line-pulse 1.4s ease-in-out infinite;
}

.hw-loader-sheet-front span:nth-child(2) {
    width: 74%;
    animation-delay: 0.15s;
}

.hw-loader-sheet-front span:nth-child(3) {
    width: 58%;
    animation-delay: 0.3s;
}

.hw-loader-pencil {
    position: absolute;
    right: 0.3rem;
    bottom: 1.3rem;
    width: 5.3rem;
    height: 0.72rem;
    border-radius: 999px;
    background: linear-gradient(90deg, #fbbf24 0%, #f59e0b 68%, #27272a 68%, #27272a 78%, #d4d4d8 78%, #d4d4d8 100%);
    box-shadow: 0 0.35rem 0.75rem rgba(24, 24, 27, 0.18);
    transform-origin: 84% 50%;
    animation: hw-pencil-write 1.8s ease-in-out infinite;
}

.hw-loader-pencil::before {
    content: '';
    position: absolute;
    left: -0.55rem;
    top: 0;
    width: 0.7rem;
    height: 0.72rem;
    border-radius: 999px 0 0 999px;
    background: #f9a8d4;
}

.hw-loader-pencil::after {
    content: '';
    position: absolute;
    right: -0.55rem;
    top: 0;
    width: 0;
    height: 0;
    border-top: 0.36rem solid transparent;
    border-bottom: 0.36rem solid transparent;
    border-left: 0.55rem solid #d6b48a;
}

.hw-loading-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #09090b;
    letter-spacing: -0.01em;
}

.hw-loading-subtext {
    margin: 0;
    max-width: 22ch;
    font-size: 0.84rem;
    line-height: 1.55;
    color: #71717a;
}

@keyframes hw-sheet-back {
    0%, 100% { transform: translate(-50%, -50%) rotate(-11deg) translateY(0.4rem); }
    50% { transform: translate(-50%, -50%) rotate(-8deg) translateY(0.1rem); }
}

@keyframes hw-sheet-mid {
    0%, 100% { transform: translate(-50%, -50%) rotate(-4deg) translateX(-0.15rem); }
    50% { transform: translate(-50%, -50%) rotate(-1deg) translateX(0); }
}

@keyframes hw-sheet-front {
    0%, 100% { transform: translate(-50%, -50%) rotate(3deg) translateY(0); }
    50% { transform: translate(-50%, -50%) rotate(1deg) translateY(-0.18rem); }
}

@keyframes hw-pencil-write {
    0%, 100% { transform: rotate(-16deg) translate(0, 0); }
    50% { transform: rotate(-8deg) translate(-0.7rem, 0.5rem); }
}

@keyframes hw-line-pulse {
    0%, 100% { opacity: 0.55; transform: scaleX(0.82); }
    50% { opacity: 1; transform: scaleX(1); }
}


/* ─────────────────────────────────────────────
   Print
───────────────────────────────────────────── */
@media print {
    .sidebar-container, .no-print { display: none !important; }
    .main-content-wrapper { margin-left: 0 !important; }
    .hw-page { background: white; padding: 0; }
}
