/* ============================================================================
   Interactive Linear Algebra - Styling
   ============================================================================ */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #0a0e1a 0%, #1a1d2e 100%);
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
}

/* ============================================================================
   Top Navigation
   ============================================================================ */

.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    padding: 0.8rem 2rem;
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1800px;
    margin: 0 auto;
}

.nav-content h1 {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(135deg, #ff6b35 0%, #4da6ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links a {
    color: #4da6ff;
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.nav-links a:hover {
    background: rgba(77, 166, 255, 0.1);
    color: #66b5ff;
}

/* ============================================================================
   Lesson Selector
   ============================================================================ */

.lesson-selector {
    position: fixed;
    top: 70px;
    left: 0;
    right: 0;
    background: rgba(26, 29, 46, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 900;
    padding: 0.8rem 2rem;
    overflow-x: auto;
}

.lesson-tabs {
    display: flex;
    gap: 0.5rem;
    max-width: 1800px;
    margin: 0 auto;
}

.lesson-tab {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #b0b0b0;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.lesson-tab:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 107, 53, 0.3);
    color: #e0e0e0;
}

.lesson-tab.active {
    background: linear-gradient(135deg, rgba(255, 107, 53, 0.2), rgba(77, 166, 255, 0.2));
    border-color: rgba(255, 107, 53, 0.5);
    color: #ffffff;
}

/* ============================================================================
   Main Container
   ============================================================================ */

.main-container {
    display: flex;
    margin-top: 140px;
    height: calc(100vh - 140px);
}

/* ============================================================================
   Control Panel
   ============================================================================ */

.control-panel {
    width: 380px;
    background: rgba(26, 29, 46, 0.95);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    overflow-y: auto;
    padding: 1.5rem;
}

.control-panel::-webkit-scrollbar {
    width: 8px;
}

.control-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.control-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 4px;
}

.control-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 53, 0.5);
}

.control-section {
    margin-bottom: 2rem;
}

.control-section h4 {
    color: #ff6b35;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 107, 53, 0.2);
}

.control-group {
    margin-bottom: 1.2rem;
}

.control-group label {
    display: block;
    font-size: 0.9rem;
    color: #b0b0b0;
    margin-bottom: 0.4rem;
    display: flex;
    justify-content: space-between;
}

.control-group label span {
    color: #4da6ff;
    font-weight: 600;
}

input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #ff8c5a);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
    transition: all 0.2s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 12px rgba(255, 107, 53, 0.6);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #ff8c5a);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.4);
}

.preset-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-top: 1.5rem;
}

.preset-buttons button {
    background: rgba(77, 166, 255, 0.1);
    border: 1px solid rgba(77, 166, 255, 0.3);
    color: #4da6ff;
    padding: 0.6rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.preset-buttons button:hover {
    background: rgba(77, 166, 255, 0.2);
    border-color: rgba(77, 166, 255, 0.5);
    transform: translateY(-1px);
}

.preset-buttons button:active {
    transform: translateY(0);
}

/* ============================================================================
   Info Section
   ============================================================================ */

.info-section {
    margin-top: 2rem;
}

.info-section h3 {
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.8rem;
}

.info-section p {
    color: #b0b0b0;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

.math-display {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 107, 53, 0.3);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.8;
    margin: 1rem 0;
    color: #e0e0e0;
}

.math-display strong {
    color: #ff6b35;
}

.lesson-notes {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(77, 166, 255, 0.05);
    border-left: 3px solid #4da6ff;
    border-radius: 4px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #b0b0b0;
}

/* ============================================================================
   Canvas Container
   ============================================================================ */

.canvas-container {
    flex: 1;
    position: relative;
    background: radial-gradient(ellipse at center, #1a1d2e 0%, #0a0e1a 100%);
}

.canvas-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* ============================================================================
   Info Modal
   ============================================================================ */

.info-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
}

.info-modal.visible {
    display: flex;
}

.info-modal-content {
    background: linear-gradient(135deg, #1a1d2e 0%, #252a42 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.info-modal-content::-webkit-scrollbar {
    width: 8px;
}

.info-modal-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.info-modal-content::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 53, 0.3);
    border-radius: 4px;
}

.info-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.info-modal-header h3 {
    font-size: 1.4rem;
    color: #ffffff;
    font-weight: 600;
}

.close-modal-btn {
    background: none;
    border: none;
    color: #b0b0b0;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ff6b35;
}

.info-modal-body {
    padding: 2rem;
}

.info-modal-body p {
    margin-bottom: 1rem;
    line-height: 1.7;
    color: #d0d0d0;
}

.info-modal-body h4 {
    color: #ff6b35;
    font-size: 1.1rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.8rem;
}

.info-modal-body ul {
    list-style: none;
    padding-left: 0;
}

.info-modal-body ul li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    line-height: 1.6;
    color: #c0c0c0;
}

.info-modal-body ul li::before {
    content: "▹";
    position: absolute;
    left: 0;
    color: #4da6ff;
    font-weight: bold;
}

.info-modal-body strong {
    color: #ffffff;
}

/* ============================================================================
   Floating Info Button
   ============================================================================ */

.floating-info-button {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff6b35, #ff8c5a);
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
    z-index: 1500;
    transition: all 0.3s ease;
}

.floating-info-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(255, 107, 53, 0.6);
}

.floating-info-button:active {
    transform: scale(0.95);
}

/* ============================================================================
   Responsive Design
   ============================================================================ */

@media (max-width: 1024px) {
    .control-panel {
        width: 320px;
    }

    .nav-content h1 {
        font-size: 1.3rem;
    }

    .lesson-tab {
        font-size: 0.85rem;
        padding: 0.5rem 1rem;
    }
}

@media (max-width: 768px) {
    .main-container {
        flex-direction: column;
        margin-top: 180px;
        height: calc(100vh - 180px);
    }

    .control-panel {
        width: 100%;
        max-height: 300px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .canvas-container {
        flex: 1;
    }

    .lesson-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .lesson-selector {
        padding: 0.6rem 1rem;
    }

    .top-nav {
        padding: 0.6rem 1rem;
    }

    .nav-content {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .floating-info-button {
        width: 45px;
        height: 45px;
        bottom: 1.5rem;
        right: 1.5rem;
    }
}

/* ============================================================================
   Animations
   ============================================================================ */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-section,
.info-section {
    animation: fadeIn 0.4s ease-out;
}

/* ============================================================================
   Utilities
   ============================================================================ */

.hidden {
    display: none !important;
}
