/* Kronig-Penney Model - Premium CSS */

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-tertiary: #1f2937;
    --bg-card: rgba(31, 41, 55, 0.8);
    --bg-glass: rgba(17, 24, 39, 0.7);
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --accent-primary: #00ff88;
    --accent-secondary: #00b4ff;
    --accent-tertiary: #ff6b6b;
    --accent-gold: #fbbf24;
    --gradient-primary: linear-gradient(135deg, #00ff88 0%, #00b4ff 100%);
    --gradient-card: linear-gradient(145deg, rgba(31, 41, 55, 0.9), rgba(17, 24, 39, 0.9));
    --border-color: rgba(255, 255, 255, 0.1);
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --shadow-glow: 0 0 20px rgba(0, 255, 136, 0.3);
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --font-primary: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --header-height: 60px;
    --panel-width: 320px;
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --bg-card: rgba(255, 255, 255, 0.95);
    --bg-glass: rgba(255, 255, 255, 0.85);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: rgba(0, 0, 0, 0.12);
    --gradient-card: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(241, 245, 249, 0.95));
    --shadow-glow: 0 0 20px rgba(0, 180, 255, 0.2);
}

[data-theme="light"] #mainCanvas {
    background: linear-gradient(180deg, #e2e8f0 0%, #f1f5f9 100%);
}

[data-theme="light"] .logo-text h1 {
    background: linear-gradient(135deg, #059669 0%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

html {
    font-size: 14px;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 24px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-5px);
    }
}

.logo-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .subtitle {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-icon:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.main-container {
    display: grid;
    grid-template-columns: var(--panel-width) 1fr var(--panel-width);
    gap: 12px;
    padding: 12px;
    padding-top: calc(var(--header-height) + 12px);
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
}

.control-panel,
.info-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    padding-bottom: 20px;
    max-height: calc(100vh - var(--header-height) - 24px);
}

.panel-section {
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px;
    transition: background 0.3s ease, border-color 0.3s ease;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
}

.section-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}

.badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    background: var(--gradient-primary);
    color: var(--bg-primary);
    border-radius: 20px;
    font-weight: 600;
}

.info-btn {
    background: none;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.7;
}

.learning-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: var(--bg-primary);
    border-color: transparent;
}

.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 8px;
}

.step {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

.step.active {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.step-line {
    width: 20px;
    height: 2px;
    background: var(--border-color);
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.preset-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.preset-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-secondary);
    transform: translateY(-2px);
}

.preset-btn.active {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.preset-icon {
    font-size: 1.5rem;
}

.preset-name {
    font-size: 0.75rem;
    font-weight: 500;
}

.control-group {
    margin-bottom: 16px;
}

.control-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

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

.value-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.value-input input {
    width: 50px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-align: center;
}

.value-input input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.value-input .unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.slider {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--gradient-primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-glow);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    font-size: 0.7rem;
    color: var(--text-muted);
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.checkbox-label input {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: 4px;
    position: relative;
    transition: all var(--transition-fast);
}

.checkbox-label input:checked+.checkmark {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

.checkbox-label input:checked+.checkmark::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid var(--bg-primary);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-text {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.color-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.animation-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.control-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.control-btn:hover {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.control-btn.playing {
    background: var(--accent-tertiary);
    color: white;
}

.hidden {
    display: none !important;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.speed-control label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.speed-control input {
    flex: 1;
    height: 4px;
}

.speed-control span {
    font-size: 0.8rem;
    color: var(--accent-primary);
    font-family: var(--font-mono);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.75rem;
}

.visualization-area {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
}

.canvas-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    overflow: hidden;
    min-height: 0;
}

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.canvas-header h2 {
    font-size: 1rem;
    font-weight: 600;
}

.view-controls {
    display: flex;
    gap: 4px;
}

.view-btn {
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.75rem;
    cursor: pointer;
}

.view-btn.active {
    background: var(--accent-secondary);
    color: white;
}

#mainCanvas {
    flex: 1;
    width: 100%;
    background: linear-gradient(180deg, #0a0e17 0%, #111827 100%);
    min-height: 200px;
}

.canvas-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.results-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.result-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--gradient-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: transform var(--transition-fast);
}

.result-card:hover {
    transform: translateY(-2px);
}

.result-icon {
    font-size: 1.5rem;
}

.result-content {
    display: flex;
    flex-direction: column;
}

.result-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.result-value {
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.result-value.highlight {
    color: var(--accent-primary);
}

.theory-content {
    font-size: 0.85rem;
    line-height: 1.7;
}

.theory-content h4 {
    color: var(--accent-secondary);
    margin-bottom: 8px;
}

.theory-content p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.theory-content strong {
    color: var(--accent-primary);
}

.equation-box {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--accent-secondary);
    padding: 12px;
    margin: 12px 0;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
}

.equation-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.equation {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--accent-primary);
}

.tip {
    background: rgba(0, 180, 255, 0.1);
    border: 1px solid rgba(0, 180, 255, 0.3);
    padding: 10px 12px;
    border-radius: var(--border-radius-sm);
    font-size: 0.8rem;
}

.observations-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.observation-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid transparent;
}

.observation-item.active {
    background: rgba(0, 255, 136, 0.1);
    border-left-color: var(--accent-primary);
}

.obs-number {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

.observation-item.active .obs-number {
    background: var(--accent-primary);
    color: var(--bg-primary);
}

.observation-item p {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.expand-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
}

.formula-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.formula-item {
    padding: 10px;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius-sm);
}

.formula-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.formula-item code {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--accent-secondary);
}

.quiz-progress {
    font-size: 0.75rem;
    color: var(--accent-gold);
    font-weight: 600;
}

.quiz-question {
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quiz-option {
    padding: 10px 14px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
}

.quiz-option:hover {
    border-color: var(--accent-secondary);
}

.quiz-option.correct {
    background: rgba(0, 255, 136, 0.2);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.quiz-option.incorrect {
    background: rgba(255, 107, 107, 0.2);
    border-color: var(--accent-tertiary);
    color: var(--accent-tertiary);
}

.notes-input {
    width: 100%;
    height: 80px;
    padding: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: 0.85rem;
    resize: vertical;
    margin-bottom: 10px;
}

.notes-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.notes-input::placeholder {
    color: var(--text-muted);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    background: var(--accent-tertiary);
    color: white;
}

.modal-body {
    padding: 24px;
}

.help-section {
    margin-bottom: 24px;
}

.help-section h4 {
    color: var(--accent-secondary);
    margin-bottom: 12px;
}

.help-section ol,
.help-section ul {
    padding-left: 20px;
    color: var(--text-secondary);
}

.help-section li {
    margin-bottom: 8px;
}

.help-section strong {
    color: var(--accent-primary);
}

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 3000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--accent-primary);
}

.toast.error {
    border-left: 4px solid var(--accent-tertiary);
}

@media (max-width: 1400px) {
    :root {
        --panel-width: 280px;
    }
}

@media (max-width: 1200px) {
    .main-container {
        grid-template-columns: 1fr;
        max-height: none;
        overflow-y: auto;
    }

    .results-panel {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 12px;
        padding-top: calc(var(--header-height) + 12px);
    }

    .results-panel {
        grid-template-columns: 1fr;
    }

    .preset-grid {
        grid-template-columns: 1fr 1fr;
    }
}