/**
 * Melodic Inversion Calculator - Styles
 */

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

.intro-section {
    padding: 0 16px;
    margin-bottom: 24px;
}

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

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

.intro-sub {
    font-size: 14px;
    color: var(--text-light);
}

/* ============================================
   CALCULATOR CARD
   ============================================ */

.calculator-section {
    padding: 0 16px;
    margin-bottom: 32px;
}

.calculator-card {
    background: var(--card);
    border-radius: 20px;
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    max-width: 800px;
    margin: 0 auto;
}

/* Input Area */
.input-area {
    margin-bottom: 24px;
}

.input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.input-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.format-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.format-label {
    font-size: 13px;
    color: var(--text-light);
}

.toggle-group {
    display: flex;
    background: var(--bg);
    border-radius: 8px;
    padding: 4px;
}

.format-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Melody Inputs */
.melody-input-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.melody-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.melody-input {
    width: 60px;
    padding: 12px 8px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    background: var(--bg);
    color: var(--text);
    transition: all 0.2s ease;
}

.melody-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.2);
}

.melody-input.error {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.melody-input.valid {
    border-color: #10b981;
}

.add-note-btn {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    border: 2px dashed var(--border);
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.add-note-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(20, 184, 166, 0.08);
}

.input-hints {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 20px;
}

/* Axis Selector */
.axis-selector {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
}

.axis-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

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

.axis-help {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: transparent;
    font-size: 12px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.axis-help:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.axis-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.axis-presets {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

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

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

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

.axis-custom label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-light);
}

.axis-custom input {
    width: 60px;
    padding: 8px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    text-align: center;
    background: var(--card);
    color: var(--text);
}

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

.axis-formula {
    font-size: 12px;
    color: var(--text-light);
    margin: 12px 0 0;
}

.axis-formula code {
    font-family: 'JetBrains Mono', monospace;
    background: var(--card);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Presets */
.presets-section {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.presets-label {
    font-size: 13px;
    color: var(--text-light);
}

.presets-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.preset-chip {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.preset-chip:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Divider */
.calc-divider {
    height: 1px;
    background: var(--border);
    margin: 24px 0;
}

/* Results Area */
.results-area {
    display: grid;
    gap: 20px;
}

.result-section {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.result-section.original {
    border-left: 4px solid var(--primary);
}

.result-section.inverted {
    border-left: 4px solid #8b5cf6;
}

.result-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-light);
    margin: 0 0 12px;
}

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

.result-notes {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 2px;
}

.result-integers {
    font-size: 14px;
    color: var(--text-light);
    font-family: 'JetBrains Mono', monospace;
}

/* Transform Arrow */
.transform-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 0;
}

.transform-arrow svg {
    color: #8b5cf6;
}

.transform-label {
    font-size: 13px;
    color: var(--text-light);
}

.transform-label span {
    font-weight: 700;
    color: #8b5cf6;
}

/* Visual Comparison */
.visual-comparison {
    background: var(--card);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
}

.comparison-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.comparison-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.comparison-hint {
    font-size: 12px;
    color: var(--text-light);
}

.comparison-graph {
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.comparison-graph svg {
    width: 100%;
    max-width: 600px;
    height: auto;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--card);
    border-radius: 16px;
    padding: 24px;
    max-width: 500px;
    width: 100%;
    position: relative;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--text-light);
    color: var(--card);
}

.modal-content h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
}

.modal-content p {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 16px;
}

.axis-diagram {
    background: var(--bg);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
}

.diagram-row {
    margin-bottom: 12px;
}

.diagram-row:last-child {
    margin-bottom: 0;
}

.diagram-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    display: block;
    margin-bottom: 6px;
}

.diagram-example {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
}

.diagram-example .arrow {
    color: #8b5cf6;
}

.diagram-example .calc {
    font-size: 11px;
    color: var(--text-light);
    margin-left: auto;
}

.modal-note {
    font-size: 13px;
    background: rgba(20, 184, 166, 0.08);
    padding: 12px;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
    margin: 0;
}

/* ============================================
   EDUCATION SECTION
   ============================================ */

.education-section {
    padding: 0 16px;
    margin-bottom: 32px;
}

.edu-card {
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    max-width: 900px;
    margin: 0 auto;
}

.edu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.edu-icon {
    font-size: 24px;
}

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

.edu-content {
    padding: 24px;
}

.edu-grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.edu-item {
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
}

.edu-item h4 {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 8px;
}

.edu-item p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
}

/* ============================================
   TUTORIAL SECTION
   ============================================ */

.tutorial-section {
    padding: 0 16px;
    margin-bottom: 32px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.tutorial-details {
    background: var(--card);
    border-radius: 16px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.tutorial-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    cursor: pointer;
    list-style: none;
    background: var(--bg);
    transition: background 0.2s ease;
}

.tutorial-summary::-webkit-details-marker {
    display: none;
}

.tutorial-summary:hover {
    background: var(--card);
}

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

.tutorial-icon {
    font-size: 24px;
}

.tutorial-title h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.expand-icon {
    font-size: 24px;
    color: var(--text-light);
    transition: transform 0.3s ease;
}

.tutorial-details[open] .expand-icon {
    transform: rotate(45deg);
}

.tutorial-content {
    padding: 24px;
}

.tutorial-step {
    margin-bottom: 32px;
}

.tutorial-step:last-child {
    margin-bottom: 0;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.step-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.step-body p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 16px;
}

.step-body ul {
    margin: 0 0 16px;
    padding-left: 24px;
}

.step-body li {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 8px;
}

/* Pitch Class Chart */
.pitch-class-chart {
    background: var(--bg);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.pc-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.pc-row:last-child {
    margin-bottom: 0;
}

.pc-note {
    background: var(--card);
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    min-width: 50px;
    text-align: center;
}

.pc-num {
    background: var(--primary);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 600;
    min-width: 28px;
    text-align: center;
}

/* Axis List */
.axis-list {
    margin: 0 0 16px;
    padding-left: 24px;
}

.axis-list li {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin-bottom: 8px;
}

/* Formula Box */
.formula-box {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(20, 184, 166, 0.1));
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    margin-bottom: 16px;
}

.formula-box code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 600;
    color: #8b5cf6;
}

/* Worked Example */
.worked-example {
    background: var(--bg);
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid var(--primary);
}

.worked-example h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
}

.example-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}

.example-row:last-of-type {
    border-bottom: none;
}

.ex-note {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    min-width: 60px;
}

.ex-calc {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-light);
    flex: 1;
}

.ex-result {
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: #8b5cf6;
}

.example-summary {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 14px;
    color: var(--text);
}

/* Insight Step */
.tutorial-step.insight .step-number {
    background: #8b5cf6;
    width: auto;
    height: auto;
    padding: 6px 10px;
    border-radius: 8px;
}

/* ============================================
   EXAMPLES SECTION
   ============================================ */

.examples-section {
    padding: 0 16px;
    margin-bottom: 32px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.section-title {
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    text-align: center;
    margin-bottom: 24px;
}

.examples-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.example-card {
    background: var(--card);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.example-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.example-header {
    margin-bottom: 12px;
}

.example-composer {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.example-work {
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
}

.example-card p {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    margin: 0;
}

/* ============================================
   VIDEO SECTION
   ============================================ */

.video-section {
    padding: 0 16px;
    margin-bottom: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.video-card {
    background: var(--card);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.video-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.video-badge {
    display: inline-block;
    padding: 4px 10px;
    background: var(--primary);
    color: white;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.video-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* ============================================
   RELATED SECTION
   ============================================ */

.related-section {
    padding: 0 16px;
    margin-bottom: 32px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.related-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.related-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 20px;
    background: var(--card);
    border-radius: 12px;
    border: 1px solid var(--border);
    text-decoration: none;
    transition: all 0.2s ease;
}

.related-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
}

.related-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.related-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.related-desc {
    font-size: 13px;
    color: var(--text-light);
}

/* ============================================
   DARK MODE
   ============================================ */

body.dark-mode .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

body.dark-mode .example-card:hover,
body.dark-mode .related-card:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

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

@media (max-width: 600px) {
    .calculator-card {
        padding: 16px;
    }

    .input-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .melody-input {
        width: 50px;
        padding: 10px 6px;
        font-size: 14px;
    }

    .axis-presets {
        flex-wrap: wrap;
    }

    .result-notes {
        font-size: 20px;
    }

    .tutorial-title h2 {
        font-size: 16px;
    }

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

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