/**
 * SIGMIX Learn Article Styles v2.0
 * /css/article.css
 * Mobile-first article display with SEO optimization
 */

/* ============================================
   1. CSS VARIABLES
   ============================================ */
:root {
    --primary: #070078;
    --primary-light: #1a1a8c;
    --primary-lighter: #2d4aa7;
    --accent: #10B981;
    --accent-light: #34D399;
    --accent-dark: #059669;
    --dark: #1a1a2e;
    --gray: #6B7280;
    --gray-light: #9CA3AF;
    --gray-200: #E5E7EB;
    --off-white: #F9FAFB;
    --white: #FFFFFF;
    --error: #EF4444;
    --radius: 8px;
    --radius-md: 10px;
    --radius-lg: 12px;
}

/* ============================================
   2. BREADCRUMB NAVIGATION
   ============================================ */
.breadcrumb-nav {
    background: var(--off-white);
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 0;
    margin-top: 70px; /* Push below fixed header */
    margin-bottom: 0;
    position: relative;
    z-index: 50;
}

.breadcrumb-nav + .article-main,
.breadcrumb-nav + main {
    margin-top: 0 !important;
}

.breadcrumb-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-list li:not(:last-child)::after {
    content: '/';
    color: var(--gray);
    font-weight: 400;
    margin: 0 0.25rem;
}

.breadcrumb-list a {
    color: var(--gray);
    text-decoration: none;
    transition: color 0.2s;
    font-weight: 500;
}

.breadcrumb-list a:hover,
.breadcrumb-list a:focus {
    color: var(--primary);
    text-decoration: underline;
}

.breadcrumb-list li[aria-current="page"] span {
    color: var(--dark);
    font-weight: 600;
}

/* RTL breadcrumb adjustments */
[dir="rtl"] .breadcrumb-nav {
    text-align: right;
}

[dir="rtl"] .breadcrumb-list {
    justify-content: flex-start;
    direction: rtl;
}

[dir="rtl"] .breadcrumb-list li:not(:last-child)::after {
    margin: 0 0.25rem;
}

/* ============================================
   3. ARTICLE CONTAINER & HEADER
   ============================================ */
.article-main {
    background: var(--white);
}

.article-container {
    padding: 2rem 0;
}

.article-header {
    margin-bottom: 2rem;
}

.article-category-link {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--primary);
    color: var(--white);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-decoration: none;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.article-category-link:hover,
.article-category-link:focus {
    background: var(--primary-light);
    transform: translateY(-1px);
}

.article-category-link i {
    font-size: 0.65rem;
}

.article-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--dark);
    line-height: 1.2;
    margin-bottom: 1rem;
    letter-spacing: -0.01em;
}

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--gray);
    font-weight: 500;
}

.meta-item i {
    color: var(--primary);
    font-size: 0.75rem;
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    padding: 0.35rem 0.75rem;
    background: var(--off-white);
    border: 1px solid var(--gray-200);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray);
    text-decoration: none;
    transition: all 0.2s;
}

.tag:hover,
.tag:focus {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* ============================================
   4. ARTICLE LAYOUT
   ============================================ */
.article-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

/* ============================================
   5. ARTICLE CONTENT
   ============================================ */
.article-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--dark);
}

/* Introduction */
.article-intro {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--gray);
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--off-white);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
}

.article-intro p:last-child {
    margin-bottom: 0;
}

/* Table of Contents */
.table-of-contents {
    background: var(--white);
    border: 2px solid var(--primary);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.table-of-contents h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-of-contents h2 i {
    font-size: 0.9rem;
}

.table-of-contents ol {
    list-style: none;
    counter-reset: toc-counter;
    margin: 0;
    padding: 0;
}

.table-of-contents ol li {
    counter-increment: toc-counter;
    margin-bottom: 0.5rem;
}

.table-of-contents ol li:last-child {
    margin-bottom: 0;
}

.table-of-contents a {
    display: block;
    color: var(--dark);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0;
    transition: all 0.2s;
    position: relative;
    padding-left: 1.75rem;
}

.table-of-contents a::before {
    content: counter(toc-counter) ".";
    position: absolute;
    left: 0;
    color: var(--primary);
    font-weight: 700;
}

.table-of-contents a:hover,
.table-of-contents a:focus {
    color: var(--primary);
    padding-left: 2rem;
}

/* Article Sections */
.article-section {
    margin-bottom: 2.5rem;
    scroll-margin-top: 100px;
}

.article-section h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
    line-height: 1.3;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--gray-200);
}

.section-content p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.section-content p:last-child {
    margin-bottom: 0;
}

.section-content strong {
    font-weight: 700;
    color: var(--dark);
}

.section-content a {
    color: var(--primary);
    text-decoration: underline;
    font-weight: 600;
}

.section-content a:hover,
.section-content a:focus {
    color: var(--accent);
}

/* Conclusion */
.article-conclusion {
    margin-bottom: 2.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, rgba(7,0,120,0.03), rgba(16,185,129,0.03));
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    scroll-margin-top: 100px;
}

.article-conclusion h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 1rem;
}

.article-conclusion p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.article-conclusion p:last-child {
    margin-bottom: 0;
}

/* ============================================
   6. FAQ SECTION
   ============================================ */
.article-faq {
    margin-bottom: 2.5rem;
    scroll-margin-top: 100px;
}

.article-faq h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.article-faq h2 i {
    color: var(--accent);
    font-size: 1.2rem;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--off-white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.2s;
}

.faq-item:hover {
    border-color: var(--primary);
}

.faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: transparent;
    border: none;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--dark);
    cursor: pointer;
    transition: all 0.2s;
}

.faq-question:hover {
    color: var(--primary);
}

.faq-question i {
    font-size: 0.75rem;
    color: var(--primary);
    transition: transform 0.3s;
    flex-shrink: 0;
}

.faq-question[aria-expanded="true"] i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-answer > div {
    padding: 0 1.25rem 1.25rem 1.25rem;
}

.faq-answer p {
    font-size: 0.9rem;
    color: var(--gray);
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

/* ============================================
   7. DISCLAIMER
   ============================================ */
.article-disclaimer {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-left: 4px solid var(--error);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 2rem;
}

.article-disclaimer p {
    font-size: 0.85rem;
    color: #991B1B;
    line-height: 1.6;
    margin: 0;
}

.article-disclaimer strong {
    font-weight: 700;
}

/* ============================================
   8. SIDEBAR (Desktop only)
   ============================================ */
.article-sidebar {
    display: none;
}

.sidebar-card {
    background: var(--off-white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.sidebar-card:last-child {
    margin-bottom: 0;
}

.sidebar-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-card h3 i {
    color: var(--primary);
    font-size: 0.9rem;
}

/* Related Stocks */
.related-stocks-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.related-stocks-list li a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.related-stocks-list li a:hover,
.related-stocks-list li a:focus {
    border-color: var(--primary);
    transform: translateX(3px);
}

.related-stocks-list li a img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    object-fit: contain;
    background: var(--off-white);
    border: 1px solid var(--gray-200);
    flex-shrink: 0;
}

.related-stocks-list li a span {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    flex: 1;
}

.related-stocks-list li a i {
    color: var(--primary);
    font-size: 0.75rem;
}

/* Share Buttons */
.share-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
}

.share-btn {
    width: 100%;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    color: var(--gray);
    text-decoration: none;
    font-size: 1.1rem;
    transition: all 0.2s;
    cursor: pointer;
}

.share-btn:hover,
.share-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.share-btn.twitter:hover,
.share-btn.twitter:focus {
    background: #1DA1F2;
    color: var(--white);
    border-color: #1DA1F2;
}

.share-btn.linkedin:hover,
.share-btn.linkedin:focus {
    background: #0A66C2;
    color: var(--white);
    border-color: #0A66C2;
}

.share-btn.whatsapp:hover,
.share-btn.whatsapp:focus {
    background: #25D366;
    color: var(--white);
    border-color: #25D366;
}

.share-btn.copy:hover,
.share-btn.copy:focus {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Sidebar CTA */
.sidebar-cta {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: var(--white);
    text-align: center;
}

.sidebar-cta h3 {
    color: var(--white);
}

.sidebar-cta h3 i {
    color: var(--accent-light);
}

.sidebar-cta p {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.9);
    line-height: 1.5;
    margin-bottom: 1rem;
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.25rem;
    background: var(--white);
    color: var(--primary);
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none;
    transition: all 0.2s;
}

.cta-btn:hover,
.cta-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255,255,255,0.3);
}

/* ============================================
   9. RESPONSIVE BREAKPOINTS
   ============================================ */

/* 480px - Small phones landscape */
@media (min-width: 480px) {
    .article-header h1 {
        font-size: 2rem;
    }
}

/* 640px - Tablets portrait */
@media (min-width: 640px) {
    .article-header h1 {
        font-size: 2.25rem;
    }
    
    .article-section h2 {
        font-size: 1.5rem;
    }
}

/* 768px - Tablets landscape */
@media (min-width: 768px) {
    .article-container {
        padding: 3rem 0;
    }
    
    .article-header {
        margin-bottom: 2.5rem;
    }
    
    .article-header h1 {
        font-size: 2.5rem;
    }
    
    .article-intro {
        font-size: 1.1rem;
        padding: 2rem;
    }
    
    .table-of-contents {
        padding: 2rem;
    }
    
    .article-section h2 {
        font-size: 1.6rem;
    }
}

/* 1024px - Desktop (SIDEBAR APPEARS) */
@media (min-width: 1024px) {
    .article-layout {
        grid-template-columns: 1fr 320px;
        gap: 3rem;
    }
    
    .article-sidebar {
        display: block;
        position: sticky;
        top: 90px;
        align-self: start;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        scrollbar-width: thin;
    }
    
    .article-sidebar::-webkit-scrollbar {
        width: 6px;
    }
    
    .article-sidebar::-webkit-scrollbar-track {
        background: var(--off-white);
        border-radius: 10px;
    }
    
    .article-sidebar::-webkit-scrollbar-thumb {
        background: var(--gray-light);
        border-radius: 10px;
    }
    
    .article-sidebar::-webkit-scrollbar-thumb:hover {
        background: var(--gray);
    }
    
    .article-header h1 {
        font-size: 2.75rem;
    }
    
    .article-section h2 {
        font-size: 1.75rem;
    }
}

/* 1280px - Large desktop */
@media (min-width: 1280px) {
    .article-layout {
        gap: 4rem;
    }
    
    .article-header h1 {
        font-size: 3rem;
    }
    
    .article-intro {
        font-size: 1.15rem;
    }
    
    .article-section h2 {
        font-size: 1.85rem;
    }
}

/* ============================================
   10. ACCESSIBILITY & SPECIAL STATES
   ============================================ */

/* Focus states */
.article-content a:focus,
.faq-question:focus,
.tag:focus,
.share-btn:focus,
.related-stocks-list a:focus,
.cta-btn:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .faq-question i {
        transition: none;
    }
    
    .faq-answer {
        transition: none;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .article-category-link,
    .tag,
    .faq-item,
    .sidebar-card {
        border-width: 2px;
    }
}

/* ============================================
   11. PRINT STYLES
   ============================================ */
@media print {
    .article-sidebar,
    .share-buttons,
    .table-of-contents {
        display: none;
    }
    
    .article-layout {
        grid-template-columns: 1fr;
    }
    
    .article-content a {
        text-decoration: underline;
        color: #000;
    }
    
    .article-content a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
    }
}