/* ============================================
   THEORY CENTER STYLES
   ============================================ */

#theory-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

#theory-overlay {
    width: 100%;
    max-width: 1000px;
    max-height: 90vh;
    background: #1a1a1a;
    border-radius: 12px;
    color: #fff;
    box-sizing: border-box;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#theory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #333;
    background: linear-gradient(135deg, #2c003e 0%, #1a1a1a 100%);
}

#theory-header h1 {
    margin: 0;
    color: #fff;
    font-size: 1.8em;
}

.btn-theory-close {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s ease;
}

.btn-theory-close:hover {
    background: #c0392b;
}

.theory-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#theory-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    background: #252525;
    border-right: 1px solid #333;
    min-width: 220px;
    overflow-y: auto;
}

.theory-topic-btn {
    background: #3a3a3a;
    color: #ddd;
    border: none;
    padding: 12px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

/* Target first 4 buttons (Theory topics) with distinct purple color */
.theory-topic-btn:nth-child(-n+4) {
    background: linear-gradient(135deg, #5a3d7a 0%, #3d2a52 100%);
    color: #fff;
}

.theory-topic-btn:nth-child(-n+4):hover {
    background: linear-gradient(135deg, #6b4a91 0%, #4d3662 100%);
    transform: translateX(4px);
}

.theory-topic-btn:hover {
    background: #4a4a4a;
    transform: translateX(4px);
}

.theory-topic-btn.is-active {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: #fff;
    border-color: #ba68c8;
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
}

/* Ensure active button from first 4 keeps active purple style */
.theory-topic-btn:nth-child(-n+4).is-active {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    border-color: #ba68c8;
}

#theory-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: #1a1a1a;
}

/* Scrollbar styling for theory content */
#theory-content::-webkit-scrollbar {
    width: 8px;
}

#theory-content::-webkit-scrollbar-track {
    background: #2a2a2a;
}

#theory-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

#theory-content::-webkit-scrollbar-thumb:hover {
    background: #777;
}

.theory-section {
    margin-bottom: 30px;
}

.theory-section h2 {
    color: #ba68c8;
    font-size: 1.5em;
    margin-bottom: 15px;
    border-bottom: 2px solid #5a3d7a;
    padding-bottom: 8px;
}

.theory-section h3 {
    color: #e1bee7;
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
}

.theory-section p {
    color: #ddd;
    line-height: 1.7;
    margin-bottom: 12px;
    font-size: 1rem;
}

.theory-section ul {
    color: #ddd;
    line-height: 1.8;
    padding-left: 25px;
    margin-bottom: 15px;
}

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

.theory-section em {
    color: #aaa;
    font-style: italic;
}

.theory-card {
    background: #2a2a2a;
    border-left: 4px solid #9c27b0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theory-card h3 {
    margin-top: 0;
    color: #fff;
    font-size: 1.3em;
}

.theory-note {
    background: #2d2d3a;
border: 1px solid #5a3d7a;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
    margin-bottom: 15px;
}

.theory-note p {
    margin: 8px 0;
    color: #e1bee7;
}

.theory-note strong {
    color: #ba68c8;
}

/* Responsive adjustments */
@media (max-width: 800px) {
    #theory-overlay {
        max-width: 95%;
    }

    .theory-body {
        flex-direction: column;
    }

    #theory-nav {
        flex-direction: row;
        flex-wrap: wrap;
        border-right: none;
        border-bottom: 1px solid #333;
        min-width: auto;
        overflow-x: auto;
    }

    .theory-topic-btn {
        flex: 1 1 45%;
        min-width: 150px;
    }

    #theory-content {
        padding: 20px;
    }

    #theory-header h1 {
        font-size: 1.3em;
    }
}

@media (max-width: 500px) {
    #theory-layer {
        padding: 10px;
    }

    #theory-header {
        padding: 15px;
    }

    #theory-content {
        padding: 15px;
    }

    .theory-topic-btn {
        flex: 1 1 100%;
        font-size: 0.85rem;
    }
}
