/* ════════════════════════════════════════════
   NicoLog Demo Mode — Styles
   ════════════════════════════════════════════ */

/* ── Container titolo con badge sovrapposto ── */
.demo-title-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

/* ── Demo Badge (sovrapposto in alto a destra sul titolo) ── */
.demo-badge {
    position: absolute;
    top: 2px;
    right: -28px;
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    font-size: 0.5rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #fff;
    background: linear-gradient(135deg, #ff6b35, #f7931a);
    border-radius: 3px;
    line-height: 1.5;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0,0,0,0.35);
}

/* ── Bottone "Crea account" nell'header (mobile only) ── */
.demo-header-cta {
    display: none; /* nascosto su desktop — il CTA è nel banner */
    align-items: center;
    gap: 6px;
    padding: 5px 13px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border-radius: 6px;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
}

.demo-header-cta:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* ── Demo Banner (persistent CTA) ── */
.demo-banner {
    position: fixed;
    top: var(--header-h, 76px);
    left: 0;
    right: 0;
    z-index: 999;
    background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12), rgba(var(--primary-rgb), 0.06));
    border-bottom: 1px solid rgba(var(--primary-rgb), 0.2);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.demo-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 8px 16px;
    max-width: 1100px;
    margin: 0 auto;
    flex-wrap: wrap;
}

.demo-banner-text {
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: center;
}

.demo-banner-text i {
    color: var(--primary);
    margin-right: 4px;
}

/* Versione breve solo su mobile, lunga su desktop */
.demo-banner-text-short { display: none; }
.demo-banner-text-long  { display: inline; }

/* Bottone CTA nel banner — visibile su desktop, nascosto su mobile */
.demo-banner-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border-radius: 6px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    white-space: nowrap;
}

.demo-banner-cta:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* ── Blocked Page Overlay ── */
.demo-blocked-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    padding: 40px 20px;
}

.demo-blocked-card {
    text-align: center;
    max-width: 440px;
    padding: 48px 32px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.demo-blocked-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    opacity: 0.6;
}

.demo-blocked-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.demo-blocked-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 24px;
}

.demo-blocked-card .cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    margin-bottom: 16px;
}

.demo-blocked-card .cta-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.demo-blocked-card .cta-secondary {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.demo-blocked-card .cta-secondary:hover {
    color: var(--primary);
}

/* ── Conversion Modal ── */
.demo-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.demo-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.demo-modal-content {
    position: relative;
    max-width: 460px;
    width: calc(100% - 32px);
    padding: 40px 32px;
    background: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.15);
    text-align: center;
    animation: demoModalIn 0.25s ease-out;
}

@keyframes demoModalIn {
    from { opacity: 0; transform: scale(0.92) translateY(12px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.demo-modal-close {
    position: absolute;
    top: 12px;
    right: 14px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}

.demo-modal-close:hover {
    color: var(--text-primary);
}

.demo-modal-icon {
    margin-bottom: 16px;
}

.demo-modal-icon i {
    font-size: 3rem;
    color: var(--success);
}

.demo-modal-content h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.demo-modal-content p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 24px;
}

.demo-modal-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: var(--primary);
    border-radius: 10px;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s;
    margin-bottom: 12px;
}

.demo-modal-cta:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.demo-modal-dismiss {
    display: block;
    width: 100%;
    padding: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
}

.demo-modal-dismiss:hover {
    color: var(--primary);
}

/* ── Dropdown demo-specific ── */
.demo-blocked-link {
    opacity: 0.55;
    position: relative;
}

.demo-lock-icon {
    font-size: 0.65rem;
    margin-left: auto;
    opacity: 0.6;
}

.demo-signup-link {
    color: var(--primary) !important;
    font-weight: 600;
}

/* ── Demo body adjustments ── */
.demo-body > main {
    /* compensate: header fixed (76px) + demo banner fixed (~36px) */
    padding-top: calc(var(--header-h, 76px) + 36px);
}

/* .app-page-main e .report-page-main hanno già padding-top per l'header —
   azzerato nella demo perché il compenso è già su #cms-content */
.demo-body .app-page-main,
.demo-body .report-page-main {
    padding-top: 1.5rem;
}

/* .statistics-main e .costi-page-main hanno padding-top con header-h incorporato —
   nella demo il compenso è già su #cms-content, quindi lo azzeriamo */
.demo-body .statistics-main,
.demo-body .costi-page-main {
    padding-top: 1.5rem;
}

/* Empty state del grafico nella pagina report demo */
.demo-body .chart-empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 160px;
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary, #888);
    font-size: 0.95rem;
    font-style: italic;
    background: var(--bg-secondary, rgba(255,255,255,0.03));
    border-radius: 8px;
    border: 1px dashed var(--border, rgba(255,255,255,0.1));
}

.demo-body .chart-wrapper {
    overflow: visible;
    min-height: 160px;
}

/* Budget sheet nella demo: altezza massima = viewport meno header+banner */
.demo-body #budget-sheet {
    max-height: calc(100vh - var(--header-h, 76px) - 36px);
    overflow-y: auto;
}

/* Nascondi footer e cookie-bar nella demo (non pertinenti nell'app) */
.demo-body .welcome-footer,
.demo-body .cookie-bar {
    display: none !important;
}

/* ── Costi page read-only overlay on add form ── */
.demo-body .costi-add-form {
    position: relative;
    pointer-events: none;
    opacity: 0.5;
}

.demo-body .costi-add-form::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

/* ── Mobile ── */
@media (max-width: 600px) {
    /* Su mobile il CTA è nell'header, non nel banner */
    .demo-banner-cta {
        display: none;
    }

    /* Mostra il CTA nell'header su mobile, all'estrema destra */
    .demo-header-cta {
        display: inline-flex;
        order: 10;
    }

    /* header-auth: justify-content flex-end per spingere tutto a destra */
    .demo-body .header-auth {
        display: flex;
        align-items: center;
        gap: 8px;
        justify-content: flex-end;
        flex: 1; /* occupa lo spazio residuo */
    }

    /* Banner: testo corto su una riga */
    .demo-banner-content {
        flex-wrap: nowrap;
    }

    .demo-banner-text-long  { display: none; }
    .demo-banner-text-short { display: inline; }

    .demo-banner-text {
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .demo-badge {
        font-size: 0.58rem;
        padding: 2px 6px;
    }

    .demo-blocked-card {
        padding: 32px 20px;
    }

    .demo-modal-content {
        padding: 28px 20px;
    }
}

/* ════════════════════════════════════════════
   Demo Tour — pulsante e popover Driver.js
   ════════════════════════════════════════════ */

/* Pulsante Tour nell'header */
.demo-tour-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    border: 1.5px solid var(--accent, #4a9eff);
    background: transparent;
    color: var(--accent, #4a9eff);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, color 0.18s;
    white-space: nowrap;
}
.demo-tour-btn:hover {
    background: var(--accent, #4a9eff);
    color: #fff;
}
.demo-tour-btn i {
    font-size: 0.82rem;
}

/* Stile personalizzato per i popover Driver.js */
.nicolog-tour-popover.driver-popover {
    background: var(--bg-card, #1e2433) !important;
    color: var(--text-primary, #e0e6f0) !important;
    border: 1px solid var(--border, rgba(255,255,255,0.1)) !important;
    border-radius: 14px !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.45) !important;
    max-width: 340px;
    padding: 32px 22px 16px !important;
}
.nicolog-tour-popover .driver-popover-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary, #e0e6f0);
    background: transparent !important;
    margin-bottom: 8px;
    padding: 0 !important;
    border: none !important;
    height: auto !important;
    min-height: 0 !important;
}
.nicolog-tour-popover .driver-popover-description {
    font-size: 0.875rem;
    color: var(--text-secondary, #a0aec0);
    line-height: 1.55;
}
.nicolog-tour-popover .driver-popover-navigation-btns {
    margin-top: 14px;
    gap: 8px;
}
.nicolog-tour-popover .driver-popover-next-btn,
.nicolog-tour-popover .driver-popover-done-btn {
    background: var(--accent, #4a9eff) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.nicolog-tour-popover .driver-popover-next-btn:hover,
.nicolog-tour-popover .driver-popover-done-btn:hover {
    background: #3a8eef !important;
    color: #fff !important;
}
.nicolog-tour-popover .driver-popover-prev-btn {
    background: transparent !important;
    color: var(--text-secondary, #a0aec0) !important;
    border: 1px solid var(--border, rgba(255,255,255,0.15)) !important;
    border-radius: 8px;
    padding: 7px 14px;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}
.nicolog-tour-popover .driver-popover-prev-btn:hover {
    background: rgba(255,255,255,0.06) !important;
    color: var(--text-primary, #e0e6f0) !important;
}
/* Blocca qualsiasi hover del CSS driver.js che risale al popover container */
.nicolog-tour-popover.driver-popover:hover {
    background: var(--bg-card, #1e2433) !important;
}
.nicolog-tour-popover .driver-popover-progress-text {
    font-size: 0.75rem;
    color: var(--text-secondary, #a0aec0);
    opacity: 0.7;
}
/* Driver.js 1.x: close-btn è position:absolute top:0 right:0 con bg e border scuri.
   Azzeriamo tutti gli stili di default e riposizioniamo dentro il padding. */
.nicolog-tour-popover .driver-popover-close-btn {
    top: 8px !important;
    right: 10px !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    color: var(--text-secondary, #a0aec0) !important;
    font-size: 1rem !important;
    line-height: 1 !important;
    width: 24px !important;
    height: 24px !important;
    padding: 0 !important;
    opacity: 0.55;
    cursor: pointer;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
.nicolog-tour-popover .driver-popover-close-btn:hover {
    opacity: 1 !important;
    background: rgba(255,255,255,0.08) !important;
}

/* Step finale centrato */
.nicolog-tour-final.driver-popover {
    text-align: center;
    max-width: 380px;
}
.nicolog-tour-final .driver-popover-navigation-btns {
    justify-content: center;
}

@media (max-width: 480px) {
    .demo-tour-btn__label { display: none; }
    .demo-tour-btn { padding: 5px 9px; }
    .nicolog-tour-popover.driver-popover { max-width: 290px; }
}
