/* Neobrutalism Design System */

:root {
    --primary: #000000;
    --secondary: #FFFFFF;
    --accent1: #FF6B35;
    --accent2: #4ECDC4;
    --accent3: #FFE66D;
    --accent4: #95E1D3;
    --accent5: #FF1744;
    --accent6: #536DFE;
    --bg: #F5F5F5;
    --border-width: 4px;
    --shadow-offset: 6px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    background-color: var(--bg);
    color: var(--primary);
    min-height: 100vh;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Login */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.subtitle {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.login-box {
    background: var(--accent3);
    border: var(--border-width) solid var(--primary);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    margin-bottom: 2rem;
}

.login-box label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.login-box input {
    width: 100%;
    padding: 1rem;
    font-size: 1.2rem;
    font-family: inherit;
    font-weight: bold;
    border: var(--border-width) solid var(--primary);
    background: var(--secondary);
    margin-bottom: 1rem;
}

.btn-primary,
.btn-secondary {
    padding: 1rem 2rem;
    font-size: 1rem;
    font-family: inherit;
    font-weight: bold;
    border: var(--border-width) solid var(--primary);
    box-shadow: 4px 4px 0 var(--primary);
    cursor: pointer;
    transition: all 0.1s;
}

.btn-primary {
    background: var(--accent1);
    color: var(--primary);
    width: 100%;
}

.btn-secondary {
    background: var(--secondary);
    color: var(--primary);
}

.btn-primary:hover,
.btn-secondary:hover {
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--primary);
}

.info-box {
    background: var(--secondary);
    border: var(--border-width) solid var(--primary);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary);
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
}

.info-box h3 {
    margin-bottom: 1rem;
}

.info-box ul {
    list-style: none;
}

.info-box li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
}

.info-box li::before {
    content: "→";
    position: absolute;
    left: 0;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    color: var(--secondary);
}

.header-left,
.header-right {
    flex: 1;
}

.header-center {
    font-size: 1.2rem;
}

.header-right {
    display: flex;
    justify-content: flex-end;
}

.progress-bar {
    width: 120px;
    height: 14px;
    background: var(--secondary);
    border: 2px solid var(--secondary);
}

.progress-fill {
    height: 100%;
    background: var(--accent2);
    transition: width 0.3s;
}

/* Layout */
main {
    padding: 1rem;
}

.annotation-layout {
    display: grid;
    grid-template-columns: 1.7fr 0.3fr;
    gap: 1rem;
    max-width: 1600px;
    margin: 0 auto;
    height: calc(100vh - 160px);
}

/* Preview Panel */
.preview-panel {
    background: var(--secondary);
    border: var(--border-width) solid var(--primary);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary);
    display: flex;
    flex-direction: column;
}

@media (max-width: 1024px) {
    .annotation-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .preview-panel {
        min-height: 350px;
    }
}

/* Binary Choice UI */
.fault-question-box {
    background: #FFF9C4;
    /* Light yellow */
    border: 3px solid var(--primary);
    padding: 1rem;
    margin-bottom: 1rem;
    text-align: center;
}

.fault-type-label {
    background: var(--primary);
    color: var(--secondary);
    display: inline-block;
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.fault-question-text {
    font-size: 1rem;
    font-weight: bold;
}

.binary-choice {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.choice-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border: 3px solid var(--primary);
    background: var(--bg);
    cursor: pointer;
    transition: all 0.1s;
    font-size: 1rem;
}

.choice-item:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 var(--primary);
}

.choice-item input[type="radio"] {
    display: none;
}

.choice-custom {
    width: 24px;
    height: 24px;
    border: 3px solid var(--primary);
    border-radius: 50%;
    background: var(--secondary);
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.choice-item input:checked+.choice-custom::after {
    content: "";
    width: 12px;
    height: 12px;
    background: var(--primary);
    border-radius: 50%;
    display: block;
}

/* Specific styles for YES/NO */
.choice-item.has-issue {
    background: #FFE0B2;
    /* Light orange */
}

.choice-item.has-issue input:checked+.choice-custom {
    background: var(--accent1);
    /* Orange */
}

.choice-item.no-issue {
    background: #C8E6C9;
    /* Light green */
}

.choice-item.no-issue input:checked+.choice-custom {
    background: #4CAF50;
    /* Green */
}

/* Selected state styling */
.choice-item input:checked~.choice-label {
    font-weight: 900;
    text-decoration: underline;
}

/* Tutorial buttons */
.tutorial-buttons .btn-next {
    background: var(--accent2);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--accent2);
    border-bottom: var(--border-width) solid var(--primary);
}

.preview-header h2 {
    margin: 0;
    font-size: 1rem;
}

#generator-badge {
    font-size: 0.8rem;
    background: var(--secondary);
    padding: 0.2rem 0.5rem;
    border: 2px solid var(--primary);
}

.iframe-wrapper {
    flex: 1;
    overflow: auto;
    border-bottom: var(--border-width) solid var(--primary);
    max-height: calc(100vh - 350px);
}

.iframe-wrapper iframe {
    width: 100%;
    height: 100%;
    min-height: 400px;
    border: none;
}

/* Component Carousel */
.component-carousel {
    display: flex;
    align-items: stretch;
    background: var(--accent3);
    min-height: 150px;
}

.nav-btn {
    padding: 0 1.2rem;
    font-size: 1.3rem;
    font-family: inherit;
    font-weight: bold;
    background: var(--secondary);
    border: none;
    border-right: var(--border-width) solid var(--primary);
    cursor: pointer;
}

.nav-btn:last-child {
    border-right: none;
    border-left: var(--border-width) solid var(--primary);
}

.nav-btn:hover {
    background: var(--accent4);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.carousel-content {
    flex: 1;
    padding: 0.5rem 1rem;
}

.component-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.comp-type {
    background: var(--accent1);
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    border: 2px solid var(--primary);
}

.comp-index {
    font-size: 0.85rem;
}

.component-preview {
    background: #1a1a1a;
    color: var(--accent2);
    padding: 0.5rem;
    font-size: 0.75rem;
    border: 2px solid var(--primary);
    max-height: 80px;
    overflow: auto;
}

.hidden-component-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 0.4rem 0;
    margin-top: 0.4rem;
    border-top: 1px dashed #666;
}

.hidden-hint {
    font-size: 0.7rem;
    color: #666;
    font-style: italic;
}

.skip-hidden-btn {
    background: var(--accent1);
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.25rem 0.6rem;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.7rem;
    cursor: pointer;
}

.skip-hidden-btn:hover {
    background: var(--accent5);
    color: #fff;
}

.attr-row {
    margin-bottom: 0.2rem;
}

.attr-key {
    color: var(--accent3);
}

.attr-value {
    color: var(--secondary);
}

/* Annotation Panel */
.annotation-panel {
    background: var(--secondary);
    border: var(--border-width) solid var(--primary);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Guidance Section */
.guidance-section {
    padding: 0.75rem;
    background: var(--accent4);
    border-bottom: var(--border-width) solid var(--primary);
}

.guidance-section h3 {
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    background: var(--primary);
    color: var(--secondary);
    padding: 0.3rem 0.5rem;
    display: inline-block;
}

.guidance-question {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    font-style: italic;
}

.guidance-check {
    font-size: 0.8rem;
    color: var(--accent6);
    margin-bottom: 0.5rem;
}

.guidance-criteria {
    background: var(--accent5);
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 2px solid var(--primary);
}

.fault-indicator {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
}

#guidance-fault {
    font-size: 0.8rem;
    color: var(--secondary);
}

.guidance-examples {
    display: flex;
    gap: 0.5rem;
    font-size: 0.75rem;
}

.example {
    flex: 1;
    padding: 0.4rem;
    border: 2px solid var(--primary);
}

.example.good {
    background: var(--accent4);
}

.example.bad {
    background: #ffcccc;
}

.example .label {
    display: block;
    margin-bottom: 0.2rem;
}

.example code {
    font-size: 0.7rem;
    word-break: break-all;
}

/* Evaluation section */
.annotation-panel h2 {
    padding: 0.5rem 0.75rem;
    background: var(--accent1);
    border-bottom: var(--border-width) solid var(--primary);
    font-size: 0.95rem;
}

.fault-checklist {
    padding: 0.5rem;
    flex: 1;
}

.checkbox-item {
    display: flex;
    align-items: center;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.3rem;
    background: var(--bg);
    border: 2px solid var(--primary);
    cursor: pointer;
    font-size: 0.85rem;
}

.checkbox-item:hover {
    background: var(--accent4);
}

.checkbox-item input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 18px;
    height: 18px;
    border: 2px solid var(--primary);
    background: var(--secondary);
    margin-right: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.checkbox-item input:checked+.checkbox-custom {
    background: var(--accent1);
}

.checkbox-item input:checked+.checkbox-custom::after {
    content: "✓";
    font-size: 0.8rem;
}

.checkbox-item.no-fault {
    background: var(--accent4);
    margin-top: 0.3rem;
}

.checkbox-item.no-fault input:checked+.checkbox-custom {
    background: var(--accent2);
}

.checkbox-item.error-item {
    background: #FFE0B2;
    margin-top: 0.3rem;
}

.checkbox-item.error-item input:checked+.checkbox-custom {
    background: var(--accent1);
}

.fault-label strong {
    margin-right: 0.3rem;
}

/* Confidence */
.confidence-section {
    padding: 0.5rem;
    border-top: var(--border-width) solid var(--primary);
    background: var(--accent3);
}

.confidence-section h3 {
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
}

.confidence-slider input[type="range"] {
    width: 100%;
    height: 14px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--secondary);
    border: 2px solid var(--primary);
}

.confidence-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent1);
    border: 2px solid var(--primary);
    cursor: pointer;
}

.confidence-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    margin-top: 0.2rem;
}

/* Actions */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-top: var(--border-width) solid var(--primary);
    background: var(--bg);
}

.action-buttons .btn-primary,
.action-buttons .btn-secondary {
    flex: 1;
    padding: 0.6rem;
    font-size: 0.85rem;
}

.component-status {
    padding: 0.4rem;
    background: var(--primary);
    color: var(--secondary);
    font-size: 0.8rem;
    text-align: center;
}

/* Completion */
.completion-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

.stats-box {
    display: flex;
    gap: 1.5rem;
    margin: 1.5rem 0;
}

.stat {
    background: var(--accent2);
    border: var(--border-width) solid var(--primary);
    box-shadow: var(--shadow-offset) var(--shadow-offset) 0 var(--primary);
    padding: 1.5rem;
    min-width: 100px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    margin-bottom: 0.3rem;
}

.stat-label {
    font-size: 0.8rem;
}

@media (max-width: 1024px) {
    .annotation-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .preview-panel {
        min-height: 350px;
    }
}

/* Instruction Banner */
.instruction-banner {
    background-color: #FFF9C4;
    border: 3px solid #000;
    padding: 14px 1.5rem;
    margin: 0 1rem 0.5rem 1rem;
    font-weight: 500;
    box-shadow: 4px 4px 0px #000;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.task-label {
    background: #000;
    color: #fff;
    padding: 4px 10px;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.instruction-banner strong {
    font-weight: 800;
    color: var(--accent5);
}

/* Exit Button */
.exit-btn {
    background: var(--accent5);
    color: #fff;
    border: 2px solid #fff;
    padding: 4px 12px;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.8rem;
    cursor: pointer;
    margin-left: 12px;
}

.exit-btn:hover {
    background: #cc0033;
}

/* Exit Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.modal-box {
    background: var(--secondary);
    border: 4px solid #000;
    box-shadow: 8px 8px 0 #000;
    padding: 2rem;
    max-width: 400px;
    text-align: center;
}

.modal-box h3 {
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.modal-box p {
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.modal-buttons button {
    padding: 0.8rem 1.5rem;
    font-family: inherit;
    font-weight: bold;
    border: 3px solid #000;
    cursor: pointer;
}

.modal-buttons .btn-cancel {
    background: var(--bg);
}

.modal-buttons .btn-confirm {
    background: var(--accent5);
    color: #fff;
}

/* Tutorial Overlay */
.tutorial-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 10000;
    pointer-events: all;
}

.tutorial-spotlight {
    position: absolute;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
    border: 4px solid var(--accent3);
    border-radius: 8px;
    z-index: 10001;
    pointer-events: none;
}

.tutorial-instruction {
    font-size: 0.85rem;
    color: #666;
    background: var(--bg);
    padding: 0.5rem;
    border: 2px dashed var(--primary);
    margin-bottom: 0.75rem;
}

.tutorial-tooltip {
    position: absolute;
    background: var(--accent3);
    border: 4px solid var(--primary);
    box-shadow: 8px 8px 0 var(--primary);
    padding: 1.5rem;
    max-width: 350px;
    z-index: 10002;
    font-family: 'Courier New', monospace;
}

.tutorial-tooltip h4 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    background: var(--primary);
    color: var(--secondary);
    padding: 0.3rem 0.6rem;
    display: inline-block;
}

.tutorial-tooltip p {
    font-size: 0.95rem;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.tutorial-tooltip .step-indicator {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.tutorial-buttons {
    display: flex;
    gap: 0.5rem;
}

.tutorial-buttons button {
    flex: 1;
    padding: 0.6rem 1rem;
    font-family: inherit;
    font-weight: bold;
    font-size: 0.85rem;
    border: 3px solid var(--primary);
    cursor: pointer;
}

.tutorial-buttons .btn-skip {
    background: var(--bg);
}

.tutorial-buttons .btn-next {
    background: var(--accent1);
}