/* =============================================
   Smart Home — Guide Article Styles
   guide.css  (condiviso da tutte le pagine guida)
   ============================================= */

:root {
    --bg:            #0a0a0f;
    --bg-surface:    #111118;
    --bg-card:       rgba(255, 255, 255, 0.04);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --border:        rgba(255, 255, 255, 0.08);
    --border-hover:  rgba(230, 51, 18, 0.4);
    --text:          #e2e8f0;
    --text-muted:    rgba(226, 232, 240, 0.6);
    --accent:        #e63312;
    --accent-dim:    rgba(230, 51, 18, 0.12);
    --accent-border: rgba(230, 51, 18, 0.25);
    --blue-dim:      rgba(59, 130, 246, 0.1);
    --blue-border:   rgba(59, 130, 246, 0.25);
    --orange-dim:    rgba(245, 158, 11, 0.1);
    --orange-border: rgba(245, 158, 11, 0.25);
    --green-dim:     rgba(16, 185, 129, 0.1);
    --green-border:  rgba(16, 185, 129, 0.25);
    --red-dim:       rgba(239, 68, 68, 0.1);
    --red-border:    rgba(239, 68, 68, 0.3);
    --font:          'Inter', system-ui, -apple-system, sans-serif;
    --font-mono:     'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    --topnav-h:      52px;
    --toc-w:         228px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }


/* ── Topnav ──────────────────────────────────────── */

.topnav {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--topnav-h);
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 24px;
    background: rgba(10, 10, 15, 0.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}
.topnav-home {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
    transition: opacity 0.2s;
}
.topnav-home:hover { opacity: 0.75; text-decoration: none; }
.topnav-home i { font-size: 11px; }
.topnav-sep { color: var(--text-muted); font-size: 13px; flex-shrink: 0; }
.topnav-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: color 0.2s;
}
.topnav-link:hover { color: var(--text); text-decoration: none; }
.topnav-current {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.toc-toggle {
    display: none;
    margin-left: auto;
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    padding: 6px 11px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.toc-toggle:hover { border-color: var(--accent); color: var(--accent); }


/* ── Layout ──────────────────────────────────────── */

.guide-layout {
    display: flex;
    max-width: 1120px;
    margin: 0 auto;
    padding: 48px 32px 96px;
    align-items: flex-start;
}


/* ── Article ─────────────────────────────────────── */

.guide-article {
    flex: 1;
    min-width: 0;
    max-width: 760px;
}

/* Header */
.guide-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.guide-badge {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 9px;
    border-radius: 6px;
}
.guide-badge--advanced     { background: rgba(239,68,68,.15);  color: #f87171; border: 1px solid rgba(239,68,68,.25);  }
.guide-badge--intermediate { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.25); }
.guide-badge--beginner     { background: rgba(16,185,129,.15); color: #34d399; border: 1px solid rgba(16,185,129,.25); }
.guide-badge--new          { background: rgba(230,51,18,.15);  color: #ff7a5e; border: 1px solid rgba(230,51,18,.3);  }

.guide-title {
    font-size: 34px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #ffffff 0%, #ffb3a3 50%, #e63312 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.guide-summary {
    font-size: 16px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 24px;
    max-width: 620px;
}

.guide-info-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 48px;
}
.guide-info-bar span { display: flex; align-items: center; gap: 6px; }
.guide-info-bar i { color: var(--accent); font-size: 12px; }


/* ── Typography ──────────────────────────────────── */

.guide-content h2 {
    font-size: 21px;
    font-weight: 700;
    margin: 52px 0 18px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    scroll-margin-top: calc(var(--topnav-h) + 20px);
    display: flex;
    align-items: center;
    gap: 10px;
}

.step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 26px;
    height: 26px;
    padding: 0 6px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

.guide-content h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 30px 0 10px;
    color: var(--text);
    scroll-margin-top: calc(var(--topnav-h) + 20px);
    display: flex;
    align-items: center;
    gap: 8px;
}

.sub-num {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 5px;
    font-family: var(--font-mono);
}

.guide-content p {
    font-size: 15px;
    color: var(--text);
    margin-bottom: 14px;
    line-height: 1.8;
}

.guide-content ul,
.guide-content ol {
    margin: 8px 0 14px 20px;
    font-size: 15px;
    line-height: 1.8;
}
.guide-content li { margin-bottom: 4px; }
.guide-content li strong { color: var(--text); }
.guide-content li code { font-family: var(--font-mono); }


/* ── Inline Code ─────────────────────────────────── */

.guide-content code {
    font-family: var(--font-mono);
    font-size: 12.5px;
    background: rgba(230, 51, 18, 0.1);
    border: 1px solid rgba(230, 51, 18, 0.2);
    color: #ffb3a3;
    padding: 1px 5px;
    border-radius: 4px;
}


/* ── Code Blocks ─────────────────────────────────── */

.code-block {
    margin: 18px 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #13131f;
}

.code-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--border);
}

.code-lang {
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.code-file {
    font-size: 11px;
    font-family: var(--font-mono);
    color: #ff7a5e;
}

.code-copy-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 11px;
    padding: 2px 8px;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}
.code-copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.code-copy-btn.copied { color: #34d399; border-color: rgba(16,185,129,0.4); }

.code-block pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background: transparent;
    border: none;
    border-radius: 0;
}
.code-block pre code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.65;
    background: none;
    border: none;
    padding: 0;
    color: #cdd6f4;
}

/* Expected output block */
.code-block.output { background: #0d1117; }
.code-block.output .code-header { background: rgba(16,185,129,0.05); border-bottom-color: rgba(16,185,129,0.15); }
.code-block.output .code-lang { color: #34d399; }
.code-block.output pre code { color: #94a3b8; }


/* ── Diagram (ASCII art) ─────────────────────────── */

.diagram-block {
    margin: 20px 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: #0d0d17;
}
.diagram-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}
.diagram-header i { color: var(--accent); font-size: 11px; }
.diagram-block pre {
    margin: 0;
    padding: 20px 24px;
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: #7c8fb0;
}


/* ── Callout Boxes ───────────────────────────────── */

.callout {
    display: flex;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 10px;
    margin: 18px 0;
    font-size: 14px;
    line-height: 1.7;
}
.callout > i { flex-shrink: 0; margin-top: 2px; font-size: 14px; }
.callout strong { font-weight: 600; }
.callout code {
    font-family: var(--font-mono);
    font-size: 12px;
    padding: 1px 5px;
    border-radius: 3px;
}

.callout--note {
    background: var(--blue-dim);
    border: 1px solid var(--blue-border);
}
.callout--note > i { color: #60a5fa; }
.callout--note code { background: rgba(59,130,246,0.15); border: 1px solid rgba(59,130,246,0.2); color: #93c5fd; }

.callout--warning {
    background: var(--orange-dim);
    border: 1px solid var(--orange-border);
}
.callout--warning > i { color: #fbbf24; }

.callout--important {
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
}
.callout--important > i { color: var(--accent); }

.callout--success {
    background: var(--green-dim);
    border: 1px solid var(--green-border);
}
.callout--success > i { color: #34d399; }


/* ── Prerequisiti Box ────────────────────────────── */

.prereq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.prereq-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
}
.prereq-item i { color: var(--accent); margin-top: 1px; flex-shrink: 0; font-size: 13px; }
.prereq-item strong { display: block; font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.prereq-item span { color: var(--text-muted); font-size: 12px; }


/* ── Troubleshooting ─────────────────────────────── */

.trouble-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid #ef4444;
    border-radius: 0 10px 10px 0;
    padding: 20px 20px 20px 18px;
    margin-bottom: 14px;
}

.trouble-title {
    font-size: 15px;
    font-weight: 600;
    color: #f87171;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.trouble-title i { font-size: 13px; flex-shrink: 0; }

.trouble-cause {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-bottom: 6px;
    line-height: 1.7;
}
.trouble-cause strong { color: var(--text); }


/* ── Cover Image ─────────────────────────────────── */

.guide-cover {
    width: 100%;
    margin: 24px 0 32px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
}
.guide-cover img {
    width: 100%;
    height: auto;
    display: block;
}
.guide-cover figcaption {
    position: absolute;
    bottom: 0;
    right: 0;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.55);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.55);
    border-radius: 10px 0 0 0;
    font-style: italic;
}


/* ── CTA Blocks ──────────────────────────────────── */

.guide-cta {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 22px 24px;
    margin: 40px 0;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(230, 51, 18, 0.09) 0%, rgba(230, 51, 18, 0.04) 100%);
    border: 1px solid rgba(230, 51, 18, 0.3);
    box-shadow: 0 4px 20px rgba(230, 51, 18, 0.08);
}
.guide-cta__icon {
    font-size: 22px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 2px;
}
.guide-cta__body { flex: 1; min-width: 0; }
.guide-cta__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}
.guide-cta__text {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 12px;
}
.guide-cta__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.guide-cta__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--accent-dim);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    transition: all 0.2s;
    text-decoration: none;
}
.guide-cta__btn:hover {
    background: rgba(230, 51, 18, 0.2);
    border-color: var(--accent);
    text-decoration: none;
}

/* Variante Telegram */
.guide-cta--telegram {
    background: linear-gradient(135deg, rgba(41, 182, 246, 0.09) 0%, rgba(41, 182, 246, 0.04) 100%);
    border-color: rgba(41, 182, 246, 0.3);
    box-shadow: 0 4px 20px rgba(41, 182, 246, 0.08);
}
.guide-cta--telegram .guide-cta__icon { color: #29b6f6; }
.guide-cta--telegram .guide-cta__btn {
    background: rgba(41, 182, 246, 0.1);
    border-color: rgba(41, 182, 246, 0.3);
    color: #29b6f6;
}
.guide-cta--telegram .guide-cta__btn:hover {
    background: rgba(41, 182, 246, 0.2);
    border-color: #29b6f6;
}

/* Bottone Telegram dentro CTA generica */
.guide-cta__btn--telegram {
    background: rgba(41, 182, 246, 0.1);
    border-color: rgba(41, 182, 246, 0.3);
    color: #29b6f6;
}
.guide-cta__btn--telegram:hover {
    background: rgba(41, 182, 246, 0.2);
    border-color: #29b6f6;
}


/* ── Share Bar ────────────────────────────────────── */

.share-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin: 20px 0;
}
.share-bar--mini {
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 0 0 40px;
}
.share-bar__label {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.share-bar__label i { color: var(--accent); font-size: 12px; }
.share-bar__icons { display: flex; gap: 6px; flex-wrap: wrap; }
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    font-family: var(--font);
}
.share-btn:hover { text-decoration: none; }
.share-btn--x:hover        { background: #000;     border-color: #000;     color: #fff; }
.share-btn--facebook:hover { background: #1877f2;  border-color: #1877f2;  color: #fff; }
.share-btn--whatsapp:hover { background: #25d366;  border-color: #25d366;  color: #fff; }
.share-btn--tg:hover       { background: #29b6f6;  border-color: #29b6f6;  color: #fff; }
.share-btn--native:hover   { background: var(--accent); border-color: var(--accent); color: #fff; }


/* ── Guide Bottom Nav ────────────────────────────── */

.guide-nav {
    display: flex;
    gap: 12px;
    margin-top: 64px;
    padding-top: 32px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.guide-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.2s;
}
.guide-nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}


/* ── TOC ─────────────────────────────────────────── */

.guide-toc {
    width: var(--toc-w);
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--topnav-h) + 24px);
    max-height: calc(100vh - var(--topnav-h) - 48px);
    overflow-y: auto;
    margin-left: 40px;
    padding-left: 24px;
    border-left: 1px solid var(--border);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.toc-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.toc-nav { display: flex; flex-direction: column; gap: 1px; }

.toc-link {
    display: block;
    font-size: 12.5px;
    color: var(--text-muted);
    padding: 5px 8px;
    border-radius: 6px;
    transition: all 0.2s;
    line-height: 1.4;
}
.toc-link:hover { color: var(--text); background: var(--bg-card); text-decoration: none; }
.toc-link.active { color: var(--accent); background: var(--accent-dim); font-weight: 500; }

.toc-divider { height: 1px; background: var(--border); margin: 8px 0; }


/* ── Footer ──────────────────────────────────────── */

.guide-footer {
    text-align: center;
    padding: 28px 24px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
}
.guide-footer a { color: var(--accent); font-weight: 500; }
.guide-footer a:hover { text-decoration: underline; }


/* ── Responsive ──────────────────────────────────── */

@media (max-width: 1050px) {
    .guide-toc { display: none; }
    .guide-layout { padding: 32px 24px 80px; }
}

@media (max-width: 640px) {
    .guide-layout { padding: 24px 16px 80px; }
    .guide-title { font-size: 24px; }
    .guide-content h2 { font-size: 18px; margin-top: 40px; }
    .guide-content h3 { font-size: 15px; }
    .guide-info-bar { gap: 10px; font-size: 12px; }
    .code-block pre { padding: 12px; }
    .code-block pre code { font-size: 12px; }
    .prereq-grid { grid-template-columns: 1fr; }
    .topnav { padding: 0 16px; }
    .toc-toggle { display: flex; }
}
