/* How Does GenAI Learn - Visualization CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Dark mode (default) */
:root {
    --primary-bg: #0f0f0f;
    --secondary-bg: #1a1a1a;
    --accent-bg: #262626;
    --text-primary: #f4f1ea;
    --text-secondary: #d4c7b0;
    --text-muted: #a08d73;
    --accent-color: #8b5cf6;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --success-color: #22c55e;
    --border-color: #404040;
    --highlight-color: #3b82f6;
    --masked-color: #f97316;
}

/* Light mode */
[data-theme="light"] {
    --primary-bg: #f8f9fa;
    --secondary-bg: #e9ecef;
    --accent-bg: #dee2e6;
    --text-primary: #212529;
    --text-secondary: #495057;
    --text-muted: #6c757d;
    --accent-color: #6366f1;
    --error-color: #dc3545;
    --warning-color: #fd7e14;
    --success-color: #198754;
    --border-color: #ced4da;
    --highlight-color: #0d6efd;
    --masked-color: #fd7e14;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

.home-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--accent-bg);
    color: var(--text-primary);
    text-decoration: none;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 18px;
    transition: all 0.3s ease;
    z-index: 1000;
    border: 1px solid var(--border-color);
}

.home-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}

.control-btn {
    position: fixed;
    top: 20px;
    background: var(--accent-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.fullscreen-btn {
    right: 80px;
}

.theme-btn {
    right: 20px;
}

.control-btn:hover {
    background: var(--accent-color);
    transform: translateY(-2px);
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 60px;
}

.header h1 {
    font-size: 2.5em;
    color: var(--accent-color);
    margin-bottom: 10px;
}

.header p {
    font-size: 1.2em;
    color: var(--text-secondary);
}

.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: var(--secondary-bg);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group label {
    color: var(--text-secondary);
    font-weight: 500;
}

.control-group input,
.control-group select {
    background: var(--accent-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
}

.control-group input[type="range"] {
    width: 80px;
}

.main-btn {
    background: var(--accent-color);
    color: var(--primary-bg);
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 20px;
}

.main-btn:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
}

.main-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 255, 136, 0.4);
    background: var(--highlight-color);
}

.training-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.source-panel,
.examples-panel {
    background: var(--secondary-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    height: 500px;
    display: flex;
    flex-direction: column;
}

.source-panel h3,
.examples-panel h3 {
    color: var(--accent-color);
    margin-bottom: 15px;
    font-size: 1.4em;
}

.source-text {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background: var(--accent-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    line-height: 1.8;
    word-wrap: break-word;
    white-space: normal;
}

.word {
    display: inline-block;
    margin-right: 4px;
    margin-bottom: 4px;
    padding: 2px 2px;
    border-radius: 4px;
    transition: all 0.3s ease;
    word-break: break-word;
}

.word.highlight {
    background: var(--highlight-color);
    color: var(--primary-bg);
    font-weight: 600;
}

.word.masked {
    background: var(--masked-color);
    color: var(--primary-bg);
    font-weight: 600;
}

.word.context {
    background: var(--highlight-color);
    color: var(--primary-bg);
    font-weight: 600;
}

.word.prediction {
    background: var(--success-color);
    color: var(--primary-bg);
    font-weight: 600;
    animation: pulse 1s ease-in-out infinite alternate;
}

@keyframes pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.05); }
}

.progress-info {
    margin-top: 15px;
    padding: 10px;
    background: var(--accent-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    color: var(--text-secondary);
    font-size: 14px;
}

.examples-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--accent-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

.examples-container {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    background: var(--accent-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.training-example {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--secondary-bg);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.training-example.training-active {
    border-color: var(--warning-color);
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
    animation: training-pulse 1s infinite;
}

@keyframes training-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

.training-example.preparing {
    border-color: var(--highlight-color);
    box-shadow: 0 0 10px rgba(0, 136, 255, 0.3);
    animation: pulse 1s infinite;
}

.training-example.current {
    border-color: var(--highlight-color);
    box-shadow: 0 0 10px rgba(0, 136, 255, 0.3);
}

.training-example.complete {
    opacity: 0.7;
}

.example-context {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
}

.context-word {
    padding: 2px 6px;
    background: var(--accent-bg);
    border-radius: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: opacity 0.3s ease, font-weight 0.3s ease;
    position: relative;
}

.example-prediction {
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    min-width: 60px;
    text-align: center;
    transition: all 0.3s ease;
}

.example-prediction.masked {
    background: var(--masked-color);
    color: var(--primary-bg);
}

.example-prediction.correct {
    background: var(--success-color);
    color: var(--primary-bg);
}

.example-prediction.incorrect {
    background: var(--error-color);
    color: var(--text-primary);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.training-status {
    text-align: center;
    padding: 20px;
    background: var(--secondary-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.status-message {
    font-size: 1.2em;
    color: var(--text-secondary);
    font-weight: 500;
}

.status-message.preparing {
    color: var(--highlight-color);
    font-weight: 600;
}

.status-message.complete {
    color: var(--success-color);
    font-weight: 600;
}

.status-message.predicting {
    color: var(--success-color);
    font-weight: 600;
}

.phase-indicator {
    color: var(--accent-color);
    font-weight: 600;
    font-size: 14px;
}

.version {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--accent-bg);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid var(--border-color);
}

.prediction-text {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.8;
    word-wrap: break-word;
    white-space: normal;
    overflow-y: auto;
    max-height: 400px;
    padding: 10px;
    background: var(--accent-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
    .training-area {
        grid-template-columns: 1fr;
    }
    
    .controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .control-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .source-panel,
    .examples-panel {
        height: 400px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .home-btn,
    .control-btn {
        position: static;
        margin: 5px;
    }
}
