/**
 * CCAB Educational Panel Styles
 * Organic-nature themed collapsible educational content panels
 * Version: 1.0.0
 */

/* ============================================
   CSS Variables (Organic-Nature Theme)
   ============================================ */
:root {
    --edu-sage: #8A9A5B;
    --edu-moss: #606C38;
    --edu-earth: #DDA15E;
    --edu-cream: #FEFAE0;
    --edu-terracotta: #BC6C25;
    --edu-dark-moss: #3d4423;
    --edu-glass-bg: rgba(255, 255, 255, 0.7);
    --edu-glass-border: rgba(138, 154, 91, 0.3);
}

/* ============================================
   Educational Panel Container
   ============================================ */
.edu-panel {
    background: var(--edu-glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 2px solid var(--edu-glass-border);
    margin: 20px;
    overflow: hidden;
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    transition: box-shadow 0.3s ease;
}

.edu-panel:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

/* Positioned variant (fixed position) */
.edu-panel.edu-panel--fixed {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    margin: 0;
    max-height: 70vh;
    overflow-y: auto;
}

.edu-panel.edu-panel--fixed.edu-panel--left {
    right: auto;
    left: 20px;
}

/* ============================================
   Panel Header (Clickable Toggle)
   ============================================ */
.edu-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    cursor: pointer;
    background: rgba(138, 154, 91, 0.1);
    transition: background 0.3s ease;
    user-select: none;
}

.edu-header:hover {
    background: rgba(138, 154, 91, 0.2);
}

.edu-icon {
    font-size: 1.2em;
}

.edu-title {
    flex: 1;
    font-family: 'Lora', Georgia, serif;
    font-weight: 600;
    font-size: 1.1em;
    color: var(--edu-moss);
}

.edu-toggle {
    color: var(--edu-sage);
    font-size: 0.9em;
    transition: transform 0.3s ease;
}

.edu-panel.open .edu-toggle {
    transform: rotate(180deg);
}

/* ============================================
   Panel Content Area
   ============================================ */
.edu-content {
    display: none;
    padding: 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease, padding 0.3s ease;
}

.edu-panel.open .edu-content {
    display: block;
    max-height: 2000px;
    padding: 20px;
}

/* ============================================
   Tab Navigation
   ============================================ */
.edu-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.edu-tab {
    padding: 8px 16px;
    border: 2px solid var(--edu-sage);
    background: transparent;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    font-size: 0.9em;
    color: var(--edu-moss);
    transition: all 0.3s ease;
}

.edu-tab:hover {
    background: rgba(138, 154, 91, 0.2);
}

.edu-tab.active {
    background: var(--edu-sage);
    color: white;
    border-color: var(--edu-sage);
}

/* ============================================
   Tab Content Panels
   ============================================ */
.edu-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.edu-tab-content.active {
    display: block;
}

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

/* ============================================
   Typography Within Panels
   ============================================ */
.edu-content h4 {
    font-family: 'Lora', Georgia, serif;
    font-size: 1.2em;
    font-weight: 600;
    color: var(--edu-moss);
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--edu-glass-border);
}

.edu-content h5 {
    font-family: 'Nunito', sans-serif;
    font-size: 1em;
    font-weight: 700;
    color: var(--edu-dark-moss);
    margin: 15px 0 10px 0;
}

.edu-content p {
    color: #444;
    line-height: 1.7;
    margin: 0 0 15px 0;
}

.edu-intro {
    font-size: 1.1em;
    font-weight: 500;
    color: var(--edu-moss) !important;
    padding: 12px 15px;
    background: rgba(138, 154, 91, 0.1);
    border-left: 4px solid var(--edu-sage);
    border-radius: 0 8px 8px 0;
    margin-bottom: 20px !important;
}

/* ============================================
   Equation Display
   ============================================ */
.edu-equation {
    background: rgba(96, 108, 56, 0.1);
    padding: 15px 20px;
    border-radius: 10px;
    font-family: 'Courier New', 'Space Mono', monospace;
    font-size: 1.1em;
    text-align: center;
    margin: 15px 0;
    color: var(--edu-dark-moss);
    border: 1px solid rgba(96, 108, 56, 0.2);
    overflow-x: auto;
}

.edu-equation-block {
    background: rgba(96, 108, 56, 0.08);
    padding: 20px;
    border-radius: 10px;
    margin: 15px 0;
    overflow-x: auto;
}

.edu-equation-block pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 0.95em;
    line-height: 1.4;
    white-space: pre;
    color: var(--edu-dark-moss);
}

/* ============================================
   Key Concepts List
   ============================================ */
.edu-key-concepts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.edu-key-concepts li {
    padding: 10px 15px;
    margin: 8px 0;
    background: rgba(254, 250, 224, 0.8);
    border-radius: 8px;
    border-left: 4px solid var(--edu-earth);
}

.edu-key-concepts li strong {
    color: var(--edu-moss);
}

/* ============================================
   Algorithm Steps
   ============================================ */
.edu-steps {
    margin: 15px 0;
}

.edu-step {
    display: flex;
    gap: 15px;
    align-items: flex-start;
    margin: 12px 0;
    padding: 10px;
    background: rgba(254, 250, 224, 0.5);
    border-radius: 10px;
}

.step-num {
    width: 32px;
    height: 32px;
    background: var(--edu-terracotta);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.95em;
    flex-shrink: 0;
}

.step-text {
    flex: 1;
    color: #444;
    line-height: 1.6;
    padding-top: 4px;
}

/* Pseudocode Block */
.edu-pseudocode {
    background: #2d3436;
    border-radius: 10px;
    margin: 15px 0;
    overflow: hidden;
}

.edu-pseudocode pre {
    margin: 0;
    padding: 15px 20px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #dfe6e9;
    overflow-x: auto;
    line-height: 1.5;
}

.edu-pseudocode .keyword {
    color: #74b9ff;
}

.edu-pseudocode .comment {
    color: #636e72;
    font-style: italic;
}

/* ============================================
   Applications Section
   ============================================ */
.edu-application {
    padding: 15px;
    margin: 12px 0;
    background: linear-gradient(135deg, rgba(254, 250, 224, 0.6) 0%, rgba(255, 255, 255, 0.4) 100%);
    border-radius: 12px;
    border: 1px solid var(--edu-glass-border);
}

.edu-application h5 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.edu-application p {
    margin-bottom: 0;
    font-size: 0.95em;
}

/* ============================================
   Explore / Tutorial Section
   ============================================ */
.edu-tutorial-step {
    padding: 15px;
    margin: 10px 0;
    background: rgba(221, 161, 94, 0.1);
    border-radius: 10px;
    border-left: 4px solid var(--edu-earth);
}

.edu-tutorial-step p {
    margin: 0;
    font-size: 0.95em;
}

.edu-tutorial-step code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.edu-try-this {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--edu-earth);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 600;
    margin-bottom: 8px;
}

/* ============================================
   References Section
   ============================================ */
.edu-refs {
    list-style: none;
    padding: 0;
    margin: 0;
}

.edu-refs li {
    margin: 8px 0;
}

.edu-refs a {
    color: var(--edu-moss);
    text-decoration: none;
    padding: 8px 12px;
    display: inline-block;
    background: rgba(138, 154, 91, 0.1);
    border-radius: 6px;
    transition: all 0.3s ease;
}

.edu-refs a:hover {
    background: rgba(138, 154, 91, 0.2);
    color: var(--edu-dark-moss);
}

.edu-refs a::before {
    content: '\2192';
    margin-right: 8px;
    opacity: 0.6;
}

/* Reference badges */
.edu-ref-badge {
    display: inline-block;
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 600;
}

.edu-ref-badge--wikipedia { background: #f0f0f0; color: #333; }
.edu-ref-badge--paper { background: #e3f2fd; color: #1565c0; }
.edu-ref-badge--video { background: #ffebee; color: #c62828; }
.edu-ref-badge--interactive { background: #e8f5e9; color: #2e7d32; }

/* ============================================
   Dark Theme Support
   ============================================ */
@media (prefers-color-scheme: dark) {
    .edu-panel {
        background: rgba(30, 35, 40, 0.9);
        border-color: rgba(138, 154, 91, 0.4);
    }

    .edu-header {
        background: rgba(138, 154, 91, 0.15);
    }

    .edu-header:hover {
        background: rgba(138, 154, 91, 0.25);
    }

    .edu-title {
        color: #b8c896;
    }

    .edu-content h4 {
        color: #b8c896;
        border-color: rgba(138, 154, 91, 0.4);
    }

    .edu-content p {
        color: #ccc;
    }

    .edu-intro {
        background: rgba(138, 154, 91, 0.15);
        color: #b8c896 !important;
    }

    .edu-equation {
        background: rgba(138, 154, 91, 0.15);
        color: #e8e6e1;
    }

    .edu-key-concepts li {
        background: rgba(60, 65, 70, 0.6);
    }

    .edu-step {
        background: rgba(60, 65, 70, 0.4);
    }

    .step-text {
        color: #ccc;
    }

    .edu-application {
        background: rgba(60, 65, 70, 0.4);
        border-color: rgba(138, 154, 91, 0.3);
    }

    .edu-tutorial-step {
        background: rgba(221, 161, 94, 0.15);
    }

    .edu-refs a {
        color: #b8c896;
        background: rgba(138, 154, 91, 0.15);
    }

    .edu-refs a:hover {
        background: rgba(138, 154, 91, 0.25);
    }
}

/* ============================================
   Mobile Responsiveness
   ============================================ */
@media (max-width: 768px) {
    .edu-panel {
        margin: 10px;
        border-radius: 12px;
    }

    .edu-panel.edu-panel--fixed {
        left: 10px;
        right: 10px;
        bottom: 10px;
        max-width: none;
    }

    .edu-header {
        padding: 12px 15px;
    }

    .edu-content {
        padding: 15px;
    }

    .edu-tabs {
        justify-content: center;
    }

    .edu-tab {
        padding: 6px 12px;
        font-size: 0.85em;
    }

    .edu-equation {
        font-size: 0.95em;
        padding: 12px 15px;
    }

    .edu-step {
        flex-direction: column;
        gap: 10px;
    }

    .step-num {
        margin-left: 0;
    }
}

/* ============================================
   Accessibility
   ============================================ */
.edu-tab:focus,
.edu-header:focus {
    outline: 3px solid var(--edu-sage);
    outline-offset: 2px;
}

.edu-panel:focus-within {
    box-shadow: 0 0 0 3px rgba(138, 154, 91, 0.3);
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
    .edu-content,
    .edu-toggle,
    .edu-tab,
    .edu-tab-content {
        transition: none;
        animation: none;
    }
}
