/* ============================================
   RESOURCE PAGES - COMMON STYLES
   ============================================ */

/* Base App Container */
.resource-app {
    max-width: 1100px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
}

/* ============================================
   HEADER
   ============================================ */

.resource-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
}

.resource-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

/* ============================================
   INTRO SECTION
   ============================================ */

.intro-section {
    padding: 24px 20px;
    text-align: center;
}

.intro-content {
    max-width: 700px;
    margin: 0 auto;
}

.intro-content p {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text);
    margin: 0;
}

.intro-content p strong {
    color: var(--primary);
}

.intro-sub {
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ============================================
   TOOL CARD (Main Interactive Area)
   ============================================ */

.tool-section {
    padding: 0 20px 24px;
}

.tool-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

body.dark-mode .tool-card {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* ============================================
   CONTROLS PANEL
   ============================================ */

.controls-panel {
    padding: 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.control-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Button Grid */
.btn-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.selector-btn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.selector-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.selector-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.4);
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

.toggle-btn {
    padding: 8px 16px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.15s ease;
}

.toggle-btn:hover {
    color: var(--text);
}

.toggle-btn.active {
    background: var(--primary);
    color: white;
}

/* ============================================
   RESULTS DISPLAY
   ============================================ */

.results-display {
    padding: 24px;
    min-height: 200px;
}

.results-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-light);
    font-size: 14px;
}

/* ============================================
   REFERENCE SECTION (Cards Grid)
   ============================================ */

.reference-section {
    padding: 0 20px 24px;
}

.section-header {
    text-align: center;
    margin-bottom: 16px;
}

.section-header h2 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.section-hint {
    font-size: 0.8rem;
    color: var(--text-light);
}

.reference-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
}

.ref-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.ref-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.12);
}

.ref-card.active {
    border-color: var(--primary);
    background: rgba(20, 184, 166, 0.08);
}

.ref-card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.ref-card-sub {
    font-size: 12px;
    color: var(--text-light);
}

/* ============================================
   QUIZ SECTION
   ============================================ */

.quiz-section {
    padding: 0 20px 24px;
}

.quiz-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
}

.quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.quiz-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.quiz-icon {
    font-size: 1.2rem;
}

.quiz-title h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.quiz-score {
    font-family: 'SF Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    background: rgba(20, 184, 166, 0.1);
    padding: 6px 12px;
    border-radius: 16px;
}

.quiz-body {
    padding: 20px;
}

.quiz-prompt {
    text-align: center;
    margin-bottom: 16px;
}

.quiz-question {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.quiz-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.quiz-option {
    padding: 12px 16px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.quiz-option:hover:not(:disabled) {
    border-color: var(--primary);
    background: rgba(20, 184, 166, 0.05);
}

.quiz-option.correct {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #16a34a;
}

.quiz-option.wrong {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #dc2626;
}

.quiz-feedback {
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    min-height: 24px;
}

.quiz-feedback.correct { color: #22c55e; }
.quiz-feedback.wrong { color: #ef4444; }

/* ============================================
   MNEMONICS / INFO CARDS
   ============================================ */

.mnemonic-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 12px;
}

.mnemonic-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.mnemonic-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.5;
}

.mnemonic-notes {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.mnemonic-note {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
    min-width: 40px;
}

.mnemonic-note .letter {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.mnemonic-note .word {
    font-size: 10px;
    color: var(--text-light);
    margin-top: 2px;
}

/* ============================================
   KEYBOARD VISUALIZATION
   ============================================ */

.keyboard-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
    overflow-x: auto;
}

.keyboard {
    display: flex;
    position: relative;
    height: 140px;
}

.white-key {
    width: 44px;
    height: 140px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 0 0 6px 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 8px;
}

.white-key:hover {
    background: #f0f9ff;
}

.white-key.active {
    background: var(--primary);
    border-color: var(--primary);
}

.white-key.active .key-label {
    color: white;
}

.black-key {
    width: 28px;
    height: 90px;
    background: #1e293b;
    border-radius: 0 0 4px 4px;
    position: absolute;
    z-index: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

.black-key:hover {
    background: #334155;
}

.black-key.active {
    background: #0d9488;
}

.key-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

body.dark-mode .white-key {
    background: #e2e8f0;
    border-color: #94a3b8;
}

body.dark-mode .white-key:hover {
    background: #cbd5e1;
}

/* ============================================
   AUDIO CONTROLS
   ============================================ */

.audio-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
}

.play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
}

.play-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(20, 184, 166, 0.5);
}

.play-btn:active {
    transform: scale(0.98);
}

.play-btn svg {
    width: 24px;
    height: 24px;
}

/* ============================================
   TABLE STYLES
   ============================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.data-table th {
    background: var(--bg);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover {
    background: var(--bg);
}

/* ============================================
   CALLOUT BOXES
   ============================================ */

.callout {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: rgba(20, 184, 166, 0.08);
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
    margin: 16px 0;
}

.callout-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.callout-content {
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.6;
}

.callout.warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
}

.callout.tip {
    background: rgba(34, 197, 94, 0.1);
    border-color: #22c55e;
}

/* ============================================
   PILL / TAG STYLES
   ============================================ */

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.pill {
    padding: 6px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s ease;
}

.pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .resource-header {
        padding: 10px 16px;
    }

    .resource-header h1 {
        font-size: 18px;
    }

    .intro-section {
        padding: 20px 16px;
    }

    .tool-section,
    .reference-section,
    .quiz-section {
        padding-left: 16px;
        padding-right: 16px;
    }

    .controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .btn-grid {
        justify-content: center;
    }

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

    .keyboard {
        transform: scale(0.85);
        transform-origin: center;
    }
}

@media (max-width: 480px) {
    .reference-grid {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .ref-card {
        padding: 12px 8px;
    }

    .quiz-options {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================
   EDUCATIONAL CONTENT
   ============================================ */

.educational-content {
    background: var(--bg);
    border-top: 1px solid var(--border);
    padding: 48px 24px;
    margin-top: 32px;
}

.educational-content .content-wrapper {
    max-width: 900px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 48px;
    align-items: start;
}

/* Main guide section */
.educational-content .guide-section {
    color: var(--text);
}

.educational-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    letter-spacing: -0.5px;
}

.educational-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-top: 24px;
    margin-bottom: 10px;
}

.educational-content p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 12px;
}

.educational-content ul,
.educational-content ol {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-light);
    margin-bottom: 12px;
    padding-left: 20px;
}

.educational-content li {
    margin-bottom: 6px;
}

/* Sidebar with related links */
.educational-content .related-tools {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    position: sticky;
    top: 100px;
}

.educational-content .related-tools h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-top: 0;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.educational-content .related-tools h3:not(:first-child) {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.educational-content .related-tools ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.educational-content .related-tools li {
    margin-bottom: 8px;
}

.educational-content .related-tools a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 12px;
    margin: 0 -12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.educational-content .related-tools a:hover {
    background: var(--bg);
    color: var(--primary);
}

.educational-content .related-tools a::before {
    content: '→';
    color: var(--primary);
    font-weight: 600;
    opacity: 0;
    transform: translateX(-4px);
    transition: all 0.2s;
}

.educational-content .related-tools a:hover::before {
    opacity: 1;
    transform: translateX(0);
}

/* Responsive for educational content */
@media (max-width: 768px) {
    .educational-content {
        padding: 32px 16px;
    }

    .educational-content .content-wrapper {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .educational-content .related-tools {
        position: static;
    }

    .educational-content h2 {
        font-size: 22px;
    }

    .educational-content h3 {
        font-size: 17px;
    }
}
