/* ========================================
   THERMODYNAMICS TOPICS CSS
   Red/Orange Heat Theme
======================================== */
.th-topics-section {
    width: 100%;
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 var(--gap-md);
}

.th-topics-container {
    background: white;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.th-topics-header {
    padding: 2rem var(--gap-lg);
    background: linear-gradient(135deg, #7f1d1d 0%, #ef4444 100%);
    color: white;
    text-align: center;
}

.th-topics-header h2 {
    font-size: 1.375rem;
    font-weight: 800;
    margin: 0 0 0.75rem 0;
}

.th-topics-header p {
    font-size: 0.85rem;
    line-height: 1.6;
    color: #fecaca;
    margin: 0;
    max-width: 700px;
    margin-inline: auto;
}

.th-topic-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background: #fef2f2;
    border-bottom: 2px solid #f87171;
}

.th-topic-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 0.85rem 0.5rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    touch-action: manipulation;
}

.th-topic-tab i {
    font-size: 1rem;
}

.th-topic-tab:hover {
    color: #991b1b;
    background: #fee2e2;
}

.th-topic-tab.active {
    color: #dc2626;
    border-bottom-color: #ef4444;
    background: white;
}

.th-topic-content {
    display: none;
    padding: 1.5rem var(--gap-md);
}

.th-topic-content.active {
    display: block;
}

.th-topic-hero {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid #fef2f2;
}

.th-topic-hero h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: #1e293b;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.th-topic-subtitle {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.5;
    margin: 0;
}

.th-concept-block {
    margin-bottom: 2rem;
}

.th-concept-block h4 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.75rem 0;
}

.th-concept-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 800;
}

.th-concept-block>p {
    font-size: 0.875rem;
    line-height: 1.7;
    color: #475569;
    margin: 0 0 1rem 0;
}

.th-insight {
    display: flex;
    gap: 0.75rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #f87171;
    border-radius: var(--radius-md);
    padding: 1rem;
    margin: 0.75rem 0;
}

.th-insight i {
    color: #dc2626;
    font-size: 1rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.th-insight span {
    font-size: 0.8rem;
    line-height: 1.6;
    color: #7f1d1d;
}

.th-formula-box {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 2px solid #f87171;
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin: 1rem 0;
    text-align: center;
}

.th-formula-main {
    font-size: 1.25rem;
    font-weight: 800;
    color: #991b1b;
    font-family: 'Courier New', monospace;
    margin-bottom: 0.75rem;
}

.th-formula-break {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.th-formula-break span {
    font-size: 0.75rem;
    color: #7f1d1d;
    font-family: 'Courier New', monospace;
}

.th-eq-table {
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 1rem 0;
}

.th-eq-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.th-eq-row:last-child {
    border-bottom: none;
}

.th-eq-row:nth-child(even) {
    background: #fef2f2;
}

.th-eq-cell {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.th-eq-note {
    font-size: 0.7rem;
    color: #94a3b8;
    font-weight: 600;
}

.th-two-col {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin: 1rem 0;
}

.th-info-col {
    background: #fef2f2;
    border: 2px solid #fca5a5;
    border-radius: var(--radius-lg);
    padding: 1rem;
}

.th-info-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #dc2626;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

.th-info-col p {
    font-size: 0.8rem;
    line-height: 1.6;
    color: #475569;
    margin: 0 0 0.5rem 0;
}

.th-compare {
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin: 1rem 0;
    font-size: 0.75rem;
}

.th-compare-head {
    display: grid;
    grid-template-columns: 1fr repeat(2, 1fr);
    background: #7f1d1d;
}

.th-compare-head .th-compare-cell {
    color: white !important;
    font-weight: 700 !important;
    font-size: 0.65rem !important;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.th-compare-row {
    display: grid;
    grid-template-columns: 1fr repeat(2, 1fr);
    border-bottom: 1px solid #f1f5f9;
}

.th-compare-row:last-child {
    border-bottom: none;
}

.th-compare-row:nth-child(even) {
    background: #fef2f2;
}

.th-compare-cell {
    padding: 0.6rem 0.5rem;
    color: #475569;
    font-size: 0.7rem;
    line-height: 1.4;
}

.th-label-cell {
    font-weight: 700;
    color: #1e293b;
}

.th-diagram {
    margin: 1.25rem 0;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.th-svg-wrap {
    background: white;
    padding: 1rem;
    display: flex;
    justify-content: center;
}

.th-svg {
    width: 100%;
    max-width: 500px;
    height: auto;
}

.th-diagram-caption {
    background: #fef2f2;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    line-height: 1.6;
    color: #64748b;
    border-top: 1px solid #e2e8f0;
}

.th-code-box {
    background: #1e293b;
    border-radius: var(--radius-lg);
    padding: 1rem 1.25rem;
    margin: 1rem 0;
    overflow-x: auto;
}

.th-code-box pre {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: #fca5a5;
    line-height: 1.5;
    margin: 0;
    white-space: pre;
}

.th-example {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-xl);
    margin-bottom: 1.75rem;
    overflow: hidden;
}

.th-ex-header {
    background: linear-gradient(135deg, #7f1d1d 0%, #991b1b 100%);
    padding: 1rem 1.25rem;
}

.th-ex-badge {
    display: inline-block;
    background: #fbbf24;
    color: #1e293b;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.th-ex-header h5 {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    margin: 0;
}

.th-ex-problem {
    padding: 1.25rem;
    background: #eff6ff;
    border-bottom: 2px solid #bfdbfe;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #1e3a5f;
}

.th-ex-solution {
    padding: 1.25rem;
}

.th-sol-step {
    margin-bottom: 1.25rem;
}

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

.th-sol-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #dc2626;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #e2e8f0;
}

.th-sol-content {
    padding-left: 0.5rem;
}

.th-sol-content p {
    font-size: 0.825rem;
    line-height: 1.6;
    color: #475569;
    margin: 0 0 0.5rem 0;
}

.th-math {
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #1e293b;
    padding: 0.3rem 0;
    line-height: 1.5;
}

.th-result {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #f87171;
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    font-weight: 700;
    color: #991b1b;
    display: inline-block;
    margin: 0.25rem 0;
}

.th-ex-answer {
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border-top: 2px solid #f87171;
    font-size: 0.825rem;
    line-height: 1.6;
    color: #7f1d1d;
}

.th-calc-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #ef4444;
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-decoration: none;
    margin-top: 0.5rem;
    transition: all 0.2s;
}

.th-calc-link:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

.th-calc-link i {
    font-size: 0.65rem;
}

@media (min-width: 576px) {
    .th-topic-tabs {
        grid-template-columns: repeat(6, 1fr);
    }

    .th-two-col {
        grid-template-columns: 1fr 1fr;
    }

    .th-topic-content {
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 768px) {
    .th-topics-section {
        max-width: 800px;
    }

    .th-topics-header h2 {
        font-size: 1.5rem;
    }

    .th-formula-main {
        font-size: 1.375rem;
    }
}

@media (min-width: 1024px) {
    .th-topics-section {
        max-width: 900px;
    }

    .th-topic-content {
        padding: 2rem;
    }
}

@media print {
    .th-topic-tabs {
        display: none;
    }

    .th-topic-content {
        display: block !important;
    }

    .th-example {
        break-inside: avoid;
    }
}