/**
 * Article Management System - Frontend Article Stylesheet
 * Clean, modern educational article design with high readability,
 * beautiful formula boxes, mobile-first responsive tables, and FAQ accordion.
 */

/* ==========================================================================
   Article Container & Layout
   ========================================================================== */
.article-page-wrapper {
    background-color: #f8fafc;
    min-height: calc(100vh - 140px);
    padding: 24px 0 60px;
}

.article-main-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Preview Bar */
.article-preview-banner {
    background: linear-gradient(90deg, #d97706, #b45309);
    color: #ffffff;
    padding: 12px 20px;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
    position: sticky;
    top: 0;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.article-preview-banner a {
    color: #ffffff;
    background: rgba(0,0,0,0.25);
    padding: 4px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.85rem;
    border: 1px solid rgba(255,255,255,0.4);
    transition: background 0.2s ease;
}

.article-preview-banner a:hover {
    background: rgba(0,0,0,0.45);
    text-decoration: none;
}

/* Article Card */
.article-card-main {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 40px 48px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.02);
    margin-bottom: 32px;
}

/* Breadcrumbs */
.article-breadcrumbs {
    margin-bottom: 20px;
    font-size: 0.88rem;
    color: #64748b;
}

.article-breadcrumbs a {
    color: #0f766e;
    text-decoration: none;
}

.article-breadcrumbs a:hover {
    text-decoration: underline;
}

.article-breadcrumbs .separator {
    margin: 0 6px;
    color: #cbd5e1;
}

/* Header */
.article-header {
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 24px;
    margin-bottom: 32px;
}

.article-category-badge {
    display: inline-block;
    background: #f0fdfa;
    color: #0f766e;
    border: 1px solid #ccfbf1;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 12px;
    border-radius: 9999px;
    margin-bottom: 14px;
    text-decoration: none;
}

.article-category-badge:hover {
    background: #ccfbf1;
    text-decoration: none;
}

.article-title {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1.25;
    color: #0f172a;
    letter-spacing: -0.02em;
    margin: 0 0 16px;
}

.article-excerpt {
    font-size: 1.15rem;
    line-height: 1.6;
    color: #475569;
    margin-bottom: 20px;
}

.article-meta-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    font-size: 0.88rem;
    color: #64748b;
    padding-top: 12px;
    border-top: 1px solid #f8fafc;
}

.article-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.article-meta-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Featured Image */
.article-featured-image-wrapper {
    margin-bottom: 32px;
    border-radius: 10px;
    overflow: hidden;
    background: #f1f5f9;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.article-featured-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-height: 440px;
}

/* Article Body Typography */
.article-body {
    font-size: 1.06rem;
    line-height: 1.78;
    color: #334155;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4 {
    color: #0f172a;
    font-weight: 700;
    line-height: 1.35;
    letter-spacing: -0.015em;
    margin: 36px 0 16px;
}

.article-body h1 { font-size: 1.85rem; }
.article-body h2 { font-size: 1.5rem; border-bottom: 2px solid #f1f5f9; padding-bottom: 8px; }
.article-body h3 { font-size: 1.25rem; }
.article-body h4 { font-size: 1.1rem; }

.article-body p {
    margin-bottom: 1.25rem;
}

.article-body ul,
.article-body ol {
    margin: 0 0 1.4rem 1.5rem;
    padding: 0;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body strong {
    color: #0f172a;
    font-weight: 600;
}

.article-body em {
    font-style: italic;
}

.article-body blockquote {
    border-left: 4px solid #0f766e;
    background: #f0fdfa;
    margin: 24px 0;
    padding: 16px 20px;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #134e4a;
}

.article-body blockquote p:last-child {
    margin-bottom: 0;
}

.article-body code {
    background: #f1f5f9;
    color: #0f766e;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.9em;
    padding: 2px 6px;
    border-radius: 4px;
}

.article-body pre {
    background: #1e293b;
    color: #f8fafc;
    padding: 16px 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
}

.article-body pre code {
    background: transparent;
    color: inherit;
    padding: 0;
}

.article-body a {
    color: #0f766e;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.article-body a:hover {
    color: #0d9488;
}

/* ==========================================================================
   Formula Box (Attractive Educational Display)
   ========================================================================== */
.formula-display-box,
.formula-box {
    background: linear-gradient(135deg, #f0fdfa 0%, #e6fffa 100%);
    border: 2px solid #0f766e;
    border-radius: 12px;
    padding: 24px 28px;
    margin: 28px 0;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.08);
}

.formula-title,
.formula-box-header {
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f766e;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.formula-title::before,
.formula-box-header::before {
    content: "📐";
    font-size: 1.2rem;
}

.formula-equation,
.formula-box-equation {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    color: #042f2e;
    background: #ffffff;
    border: 1px solid #ccfbf1;
    border-radius: 8px;
    padding: 14px 20px;
    text-align: center;
    margin: 12px 0 16px;
    letter-spacing: 0.05em;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.03);
}

.formula-expanded {
    text-align: center;
    font-size: 0.95rem;
    color: #115e59;
    font-weight: 600;
    margin-bottom: 14px;
}

.formula-vars-breakdown,
.formula-box-where {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed #99f6e4;
    font-size: 0.95rem;
}

.formula-vars-list {
    list-style: none !important;
    margin: 8px 0 0 0 !important;
    padding: 0 !important;
}

.formula-vars-list li {
    padding: 4px 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.formula-vars-list li::before {
    content: "•";
    color: #0f766e;
    font-weight: bold;
}

.formula-mini-box {
    background: #f8fafc;
    border-left: 3px solid #0f766e;
    padding: 8px 14px;
    border-radius: 0 6px 6px 0;
    margin: 8px 0;
}

.formula-mini-box .formula-label {
    font-size: 0.85rem;
    color: #64748b;
    display: block;
}

.formula-mini-box .formula-val {
    font-family: ui-monospace, monospace;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

/* ==========================================================================
   Geometric Clarification & Callout Boxes
   ========================================================================== */
.clarification-callout {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
    border-radius: 0 10px 10px 0;
    padding: 20px 24px;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.08);
}

.clarification-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1rem;
    color: #92400e;
    margin-bottom: 8px;
}

.clarification-callout p {
    color: #78350f;
    margin-bottom: 8px;
}

.clarification-callout p:last-child {
    margin-bottom: 0;
}

/* Comparison Cards */
.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin: 24px 0;
}

.comparison-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px 22px;
    position: relative;
}

.comparison-card.highlight {
    background: #f0fdfa;
    border-color: #0f766e;
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.08);
}

.comparison-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    background: #e2e8f0;
    color: #475569;
}

.comparison-badge.active {
    background: #0f766e;
    color: #ffffff;
}

.comparison-card h3 {
    margin: 0 0 8px !important;
    font-size: 1.25rem !important;
    border: none !important;
    padding: 0 !important;
}

.formula-note {
    font-size: 0.82rem;
    color: #64748b;
    margin-top: 8px !important;
}

/* Worked Example Box */
.example-box {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    overflow: hidden;
    margin: 24px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.example-header {
    background: #f1f5f9;
    padding: 12px 18px;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.98rem;
    color: #1e293b;
}

.example-tag {
    background: #0f766e;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 4px;
    letter-spacing: 0.04em;
}

.example-body {
    padding: 18px 20px;
}

.calculation-steps {
    background: #f8fafc;
    border-radius: 6px;
    padding: 12px 16px;
    margin: 12px 0;
    font-family: ui-monospace, monospace;
    font-size: 1rem;
    color: #0f766e;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.example-result {
    font-size: 1.08rem;
    color: #064e3b;
    font-weight: 600;
    margin-top: 10px !important;
}

/* ==========================================================================
   Responsive Tables
   ========================================================================== */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 24px 0;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
}

.article-table,
.table-responsive table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    text-align: left;
}

.article-table thead,
.table-responsive table thead {
    background: #0f766e;
    color: #ffffff;
}

.article-table th,
.table-responsive table th {
    padding: 12px 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-bottom: 1px solid #0d9488;
    white-space: nowrap;
}

.article-table td,
.table-responsive table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}

.article-table tbody tr:nth-child(even),
.table-responsive table tbody tr:nth-child(even) {
    background: #f8fafc;
}

.article-table tbody tr:hover,
.table-responsive table tbody tr:hover {
    background: #f0fdfa;
}

/* ==========================================================================
   FAQ Accordion Section
   ========================================================================== */
.article-faq-wrapper {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 36px 40px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.article-faq-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
    letter-spacing: -0.015em;
}

.article-faq-subtitle {
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 24px;
}

.faq-accordion-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-accordion-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.faq-accordion-item.active {
    border-color: #0f766e;
    box-shadow: 0 2px 8px rgba(15, 118, 110, 0.08);
}

.faq-accordion-question {
    width: 100%;
    padding: 16px 20px;
    background: #ffffff;
    border: none;
    text-align: left;
    font-size: 1.02rem;
    font-weight: 700;
    color: #0f172a;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.faq-accordion-item.active .faq-accordion-question {
    background: #f0fdfa;
    color: #0f766e;
}

.faq-accordion-question:hover {
    background: #f8fafc;
}

.faq-icon-toggle {
    font-size: 0.85rem;
    color: #0f766e;
    transition: transform 0.25s ease;
    flex-shrink: 0;
}

.faq-accordion-item.active .faq-icon-toggle {
    transform: rotate(180deg);
}

.faq-accordion-answer {
    padding: 0 20px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    font-size: 0.98rem;
    line-height: 1.7;
    color: #475569;
    background: #ffffff;
}

.faq-accordion-item.active .faq-accordion-answer {
    padding: 16px 20px 20px;
    max-height: 500px;
    border-top: 1px solid #ccfbf1;
}

/* ==========================================================================
   Related Articles Section
   ========================================================================== */
.related-articles-wrapper {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px 36px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.related-articles-title {
    font-size: 1.45rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

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

.related-article-card {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    background: #ffffff;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    display: flex;
    flex-direction: column;
}

.related-article-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.08);
    border-color: #0f766e;
}

.related-article-thumb {
    width: 100%;
    height: 140px;
    object-fit: cover;
    background: #f1f5f9;
    display: block;
}

.related-article-content {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.related-article-heading {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.4;
    margin: 0 0 8px;
}

.related-article-heading a {
    color: #0f172a;
    text-decoration: none;
}

.related-article-heading a:hover {
    color: #0f766e;
}

.related-article-snippet {
    font-size: 0.88rem;
    line-height: 1.5;
    color: #64748b;
    margin-bottom: 12px;
    flex-grow: 1;
}

.related-article-link {
    font-size: 0.88rem;
    font-weight: 600;
    color: #0f766e;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.related-article-link:hover {
    color: #0d9488;
    text-decoration: underline;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 768px) {
    .article-card-main {
        padding: 24px 18px;
        border-radius: 8px;
    }

    .article-title {
        font-size: 1.75rem;
    }

    .article-excerpt {
        font-size: 1.02rem;
    }

    .formula-equation,
    .formula-box-equation {
        font-size: 1.7rem;
        padding: 10px 12px;
    }

    .article-faq-wrapper,
    .related-articles-wrapper {
        padding: 24px 18px;
    }

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