/* ==========================================================================
   Softa - Stili Sezione Articoli & Blog (SEO & GEO Optimized)
   ========================================================================== */

/* Hero Sezione Articoli */
.articles-hero {
    background: var(--primary-gradient);
    color: white;
    padding: 140px 0 60px;
    position: relative;
    text-align: center;
}

.articles-hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
}

.articles-hero p {
    font-size: 1.25rem;
    max-width: 800px;
    margin: 0 auto;
    opacity: 0.92;
}

/* Breadcrumb */
.breadcrumb {
    padding: 1rem 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span.sep {
    opacity: 0.5;
}

/* Barra di Ricerca & Filtri Categorie */
.blog-controls {
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    margin: -30px auto 40px;
    max-width: 1000px;
    box-shadow: var(--shadow-medium);
    border: 1px solid rgba(0,0,0,0.06);
    position: relative;
    z-index: 10;
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 1rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1.05rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: all 0.25s ease;
    box-sizing: border-box;
}

.search-input-wrapper input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.search-icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
}

.filter-pills {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.filter-pill {
    padding: 0.5rem 1.1rem;
    border-radius: 25px;
    background: #f1f5f9;
    color: #475569;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.filter-pill:hover,
.filter-pill.active {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Griglia Articoli (Archivio & Home) */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 2rem;
    margin-bottom: 80px;
}

.article-card {
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.07);
    border: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    color: inherit;
}

.article-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.18);
    border-color: rgba(102, 126, 234, 0.3);
}

.article-card-thumb {
    width: 100%;
    height: 210px;
    background: #f8fafc;
    overflow: hidden;
    position: relative;
    border-bottom: 1px solid #eef2f6;
}

.article-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.article-card:hover .article-card-thumb img {
    transform: scale(1.04);
}

.article-card-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.35rem 0.85rem;
    border-radius: 20px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.article-card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-card-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.article-card-title {
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.35;
    margin-bottom: 0.8rem;
    color: var(--text-primary);
    transition: color 0.2s ease;
}

.article-card:hover .article-card-title {
    color: #667eea;
}

.article-card-excerpt {
    font-size: 0.95rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 1.2rem;
    flex-grow: 1;
}

.article-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: #667eea;
    font-size: 0.95rem;
    padding-top: 1rem;
    border-top: 1px solid #f1f5f9;
}

/* ==========================================================================
   Layout Singolo Articolo
   ========================================================================== */

.single-article-header {
    background: linear-gradient(135deg, #1e1e38 0%, #2a2a50 100%);
    color: white;
    padding: 130px 0 50px;
    position: relative;
}

.single-article-meta {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.95rem;
    opacity: 0.9;
    margin-bottom: 1.2rem;
}

.single-article-header h1 {
    font-size: 2.8rem;
    font-weight: 800;
    line-height: 1.25;
    margin-bottom: 1.5rem;
    max-width: 1050px;
}

.article-hero-image {
    max-width: 1100px;
    margin: -40px auto 40px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
    background: #0f172a;
}

.article-hero-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Contenuto Articolo */
.article-content-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 3.5rem;
    max-width: 1200px;
    margin: 0 auto 80px;
}

.article-main-body {
    font-size: 1.125rem;
    line-height: 1.8;
    color: #334155;
}

.article-main-body h2 {
    font-size: 1.85rem;
    font-weight: 800;
    color: #0f172a;
    margin: 2.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.article-main-body h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1e293b;
    margin: 2rem 0 0.8rem;
}

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

.article-main-body ul, 
.article-main-body ol {
    margin-bottom: 1.5rem;
    padding-left: 1.8rem;
}

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

/* Direct Answer Box (Ottimizzato GEO / AI) */
.direct-answer-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.08) 100%);
    border-left: 5px solid #667eea;
    border-radius: 0 16px 16px 0;
    padding: 1.5rem 1.8rem;
    margin: 0 0 2rem;
    font-size: 1.15rem;
    line-height: 1.7;
    color: #1e293b;
}

.direct-answer-box strong {
    color: #667eea;
}

/* FAQ Box */
.faq-box {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.faq-item {
    border-bottom: 1px solid #e2e8f0;
    padding: 1rem 0;
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-question {
    font-size: 1.15rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.5rem;
}

.faq-answer {
    color: #475569;
    font-size: 1.05rem;
}

/* Sidebar & Table of Contents */
.article-sidebar {
    position: sticky;
    top: 100px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-card {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.sidebar-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #0f172a;
}

.toc-list {
    list-style: none;
    padding: 0;
}

.toc-list li {
    margin-bottom: 0.6rem;
}

.toc-list a {
    color: #64748b;
    text-decoration: none;
    font-size: 0.95rem;
    line-height: 1.4;
    transition: all 0.2s;
    display: block;
}

.toc-list a:hover {
    color: #667eea;
    padding-left: 4px;
}

/* CTA Finale nell'articolo */
.article-cta-box {
    background: var(--primary-gradient);
    color: white;
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    margin: 3rem 0;
}

.article-cta-box h3 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    color: white;
}

.article-cta-box p {
    font-size: 1.1rem;
    opacity: 0.95;
    max-width: 600px;
    margin: 0 auto 1.5rem;
}

.article-cta-box .btn-white {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 0.9rem 2rem;
    font-weight: 700;
    border-radius: 12px;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.article-cta-box .btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ==========================================================================
   Diagrammi Mermaid (Ottimizzati Verticali, 3D & Mobile)
   ========================================================================== */
.mermaid-diagram-box {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: 20px;
    padding: 2.5rem 1.8rem;
    margin: 3rem auto;
    max-width: 600px;
    box-shadow: 0 20px 40px -15px rgba(102, 126, 234, 0.15),
                0 4px 16px rgba(0, 0, 0, 0.04),
                inset 0 1px 0 rgba(255, 255, 255, 0.9);
    position: relative;
    overflow: hidden;
}

/* Texture a punti sfumati stile blueprint tech */
.mermaid-diagram-box::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: radial-gradient(rgba(102, 126, 234, 0.12) 1.2px, transparent 1.2px);
    background-size: 16px 16px;
    pointer-events: none;
    opacity: 0.8;
}

.mermaid-diagram-box .mermaid {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
}

.mermaid-diagram-box svg {
    max-width: 100% !important;
    height: auto !important;
    overflow: visible;
}

/* Effetto 3D e rilievo sui nodi SVG */
.mermaid svg .node rect,
.mermaid svg .node polygon,
.mermaid svg .node circle {
    filter: drop-shadow(0 6px 12px rgba(15, 23, 42, 0.09)) drop-shadow(0 1px 3px rgba(15, 23, 42, 0.06));
    rx: 12px !important;
    ry: 12px !important;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Interazione al passaggio del mouse sui nodi */
.mermaid svg .node:hover rect,
.mermaid svg .node:hover polygon,
.mermaid svg .node:hover circle {
    filter: drop-shadow(0 12px 24px rgba(102, 126, 234, 0.3)) drop-shadow(0 3px 6px rgba(102, 126, 234, 0.15));
    cursor: default;
}

/* Testo dei nodi */
.mermaid svg .node .label {
    font-weight: 600;
    letter-spacing: -0.2px;
}

/* Frecce e percorsi di connessione */
.mermaid svg .edgePath path.path {
    stroke-width: 2.5px !important;
    stroke: #667eea !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    filter: drop-shadow(0 2px 4px rgba(102, 126, 234, 0.25));
}

.mermaid svg .marker {
    fill: #667eea !important;
    stroke: #667eea !important;
}

/* Badge 3D per le etichette sulle frecce (es. Corretto / Errato) */
.mermaid svg .edgeLabel {
    background: transparent !important;
}

.mermaid svg .edgeLabel p,
.mermaid svg .edgeLabel span {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    padding: 0.25rem 0.75rem !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08) !important;
    display: inline-block;
}

/* Raggruppamenti (subgraph / cluster) */
.mermaid svg .cluster rect {
    rx: 16px !important;
    ry: 16px !important;
    fill: #f8fafc !important;
    stroke: #cbd5e1 !important;
    stroke-width: 1.5px !important;
    stroke-dasharray: 4,4 !important;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.03));
}

/* ==========================================================================
   Visual Process Stepper (Infografica a Tappe di Processo 3D)
   ========================================================================== */
.process-stepper {
    position: relative;
    max-width: 680px;
    margin: 3rem auto;
    padding: 0.5rem 0 0.5rem 1rem;
}

/* Linea verticale continua sfumata che collega tutte le tappe */
.process-stepper::before {
    content: '';
    position: absolute;
    top: 30px;
    bottom: 30px;
    left: 31px;
    width: 3px;
    background: linear-gradient(180deg, #667eea 0%, #764ba2 70%, #a78bfa 100%);
    border-radius: 3px;
    box-shadow: 0 0 12px rgba(102, 126, 234, 0.5);
}

.process-step {
    position: relative;
    display: flex;
    gap: 1.8rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

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

/* Indicatore circolare numerato a rilievo 3D */
.step-marker {
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1rem;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.4), 
                0 0 0 4px rgba(255, 255, 255, 0.95),
                inset 0 2px 2px rgba(255, 255, 255, 0.4);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.process-step:hover .step-marker {
    transform: scale(1.12);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.6), 
                0 0 0 4px rgba(255, 255, 255, 1);
}

/* Scheda descrittiva della tappa */
.step-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 1.4rem 1.8rem;
    flex-grow: 1;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.04), 
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.process-step:hover .step-card {
    transform: translateX(6px);
    border-color: rgba(102, 126, 234, 0.35);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.12), 
                0 2px 6px rgba(0, 0, 0, 0.04);
}

.step-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.45rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.step-desc {
    font-size: 0.98rem;
    color: #64748b;
    line-height: 1.65;
    margin: 0;
}

/* Adattamento Mobile */
@media (max-width: 600px) {
    .process-stepper {
        padding-left: 0;
    }
    .process-stepper::before {
        left: 21px;
    }
    .process-step {
        gap: 1.2rem;
    }
    .step-marker {
        width: 38px;
        height: 38px;
        font-size: 0.95rem;
    }
    .step-card {
        padding: 1.1rem 1.3rem;
    }
}

/* Responsività */
@media (max-width: 992px) {
    .article-content-layout {
        grid-template-columns: 1fr;
    }
    .article-sidebar {
        display: none;
    }
    .single-article-header h1 {
        font-size: 2.1rem;
    }
}
