/* =============================================================
   Tool Olistici — Design system "Notte Astrale"
   Bootstrap è usato solo per griglia/responsive/tabelle:
   tutta l'identità visiva vive qui.
   ============================================================= */

:root {
    /* Palette */
    --indaco-900: #120E2A;   /* fondale profondo */
    --indaco-800: #171233;
    --indaco-700: #1F1A46;   /* pannelli */
    --indaco-600: #2A2360;   /* bordi/hover */
    --oro:        #E8B65A;   /* accento primario: luce di candela */
    --oro-soft:   #F2D399;
    --rosa:       #E9A7B6;   /* accento secondario: quarzo rosa */
    --lavanda:    #B9AFD6;   /* testo muto */
    --panna:      #F5F1FF;   /* testo chiaro */

    /* Tipografia */
    --font-display: 'Fraunces', Georgia, serif;
    --font-body:    'Instrument Sans', system-ui, sans-serif;
    --font-num:     'Space Grotesk', ui-monospace, monospace;

    /* Misure */
    --radius:   18px;
    --radius-sm: 10px;
    --maxw:     1180px;
    --shadow:   0 24px 60px -30px rgba(0, 0, 0, .8);
    --shadow-glow: 0 0 60px -12px rgba(232, 182, 90, .35);

    /* Transizioni */
    --ease: cubic-bezier(.22, .61, .36, 1);
}

/* ---------- Reset morbido ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--panna);
    background:
        radial-gradient(1200px 700px at 80% -10%, rgba(233, 167, 182, .12), transparent 60%),
        radial-gradient(1000px 800px at 0% 10%, rgba(232, 182, 90, .10), transparent 55%),
        linear-gradient(180deg, var(--indaco-900), var(--indaco-800) 40%, var(--indaco-900));
    background-attachment: fixed;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Sottile grana stellare su tutta la pagina */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(1px 1px at 20% 30%, rgba(255, 255, 255, .5), transparent),
        radial-gradient(1px 1px at 70% 60%, rgba(255, 255, 255, .35), transparent),
        radial-gradient(1px 1px at 40% 80%, rgba(255, 255, 255, .4), transparent),
        radial-gradient(1px 1px at 85% 20%, rgba(255, 255, 255, .3), transparent),
        radial-gradient(1.5px 1.5px at 55% 45%, rgba(255, 255, 255, .25), transparent);
    opacity: .6;
    pointer-events: none;
    z-index: 0;
}

/* ---------- Tipografia ---------- */
h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.08;
    letter-spacing: -.01em;
    color: var(--panna);
    margin: 0 0 .5em;
}

.eyebrow {
    font-family: var(--font-num);
    text-transform: uppercase;
    letter-spacing: .28em;
    font-size: .72rem;
    color: var(--oro);
    font-weight: 500;
}

a { color: var(--oro-soft); text-decoration: none; }
a:hover { color: var(--oro); }

/* ---------- Layout ---------- */
.container-x {
    width: 100%;
    max-width: var(--maxw);
    margin-inline: auto;
    padding-inline: clamp(1.1rem, 4vw, 2.5rem);
    position: relative;
    z-index: 1;
}

.section { padding-block: clamp(3.5rem, 8vw, 1.5rem); }

/* ---------- Bottoni ---------- */
.btn-astral {
    --b: var(--oro);
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: .98rem;
    padding: .85rem 1.6rem;
    border-radius: 999px;
    border: 1px solid transparent;
    color: var(--indaco-900);
    background: linear-gradient(135deg, var(--oro-soft), var(--oro));
    cursor: pointer;
    transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .25s var(--ease);
    box-shadow: var(--shadow-glow);
}
.btn-astral:hover {
    color: var(--indaco-900);
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-weight: 600;
    padding: .8rem 1.5rem;
    border-radius: 999px;
    border: 1px solid var(--indaco-600);
    color: var(--panna);
    background: rgba(255, 255, 255, .02);
    cursor: pointer;
    transition: border-color .25s var(--ease), background .25s var(--ease), color .2s;
}
.btn-ghost:hover {
    border-color: var(--oro);
    color: var(--oro-soft);
    background: rgba(232, 182, 90, .06);
}

/* ---------- Navbar ---------- */
.site-nav {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
    background: linear-gradient(180deg, rgba(18, 14, 42, .85), rgba(18, 14, 42, .35));
    border-bottom: 1px solid rgba(185, 175, 214, .12);
}
.site-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 84px;
}
.brand {
    display: inline-flex;
    align-items: center;
}
.brand-logo {
    height: 60px;
    width: auto;
    display: block;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    list-style: none;
    margin: 0; padding: 0;
}
.nav-links a { color: var(--lavanda); font-weight: 500; font-size: .95rem; }
.nav-links a:hover { color: var(--panna); }
/* Voce account/accedi: pill discreta, chiara come azione */
.nav-links a.nav-cta {
    border: 1px solid var(--indaco-600);
    padding: .45rem 1.05rem;
    border-radius: 999px;
    color: var(--panna);
}
.nav-links a.nav-cta:hover {
    border-color: var(--oro);
    color: var(--oro-soft);
    background: rgba(232, 182, 90, .06);
}

/* Bootstrap: le utility .border/.rounded-2/.px-3/.py-2 sul markup leggono
   queste variabili --bs-*, invece di riscrivere bordo/raggio/padding a mano. */
.nav-tools-select {
    --bs-border-color: var(--indaco-600);
    --bs-border-radius: var(--radius-sm);
}
.nav-tools-select .form-select {
    background-color: rgba(255, 255, 255, .03);
    color: var(--lavanda);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: .95rem;
    padding-right: 2.2rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23B9AFD6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .7rem center;
}
.nav-tools-select .form-select:hover,
.nav-tools-select .form-select:focus {
    outline-color: var(--indaco-900);
    border-color: var(--oro);
    color: var(--panna);
}
.nav-tools-select .form-select option,
.nav-tools-select .form-select optgroup {
    color: #111 !important;
    background-color: #fff !important;
}

.lang-switch { display: inline-flex; gap: .3rem; }
.lang-switch a {
    font-family: var(--font-num);
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: .25rem .5rem;
    border-radius: 6px;
    color: var(--lavanda);
}
.lang-switch a.active { color: var(--indaco-900); background: var(--oro); }

.nav-toggle {
    display: none;
    background: none; border: 0; color: var(--panna);
    font-size: 1.5rem; cursor: pointer;
}

/* ---------- Menu mobile (offcanvas Bootstrap) ----------
   Il componente .offcanvas non ha CSS proprio (nel progetto è caricato solo
   bootstrap-grid + bootstrap-utilities, non il bundle intero): qui si
   ricostruisce solo il comportamento essenziale (posizione, scorrimento,
   backdrop) di cui ha bisogno il JS di Bootstrap, con l'aspetto del tema. */
.nav-offcanvas {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    width: 100%;
    visibility: hidden;
    background: var(--indaco-800);
    border-left: 1px solid rgba(185, 175, 214, .12);
    outline: 0;
    transform: translateX(100%);
    transition: transform .3s var(--ease);
}
.nav-offcanvas.show,
.nav-offcanvas.showing { visibility: visible; }
.nav-offcanvas.show { transform: none; }
.offcanvas-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1040;
    background: var(--indaco-900);
    opacity: 0;
    transition: opacity .15s linear;
}
.offcanvas-backdrop.show { opacity: .7; }
.nav-offcanvas .offcanvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.4rem clamp(1.1rem, 4vw, 2rem);
    border-bottom: 1px solid rgba(185, 175, 214, .12);
}
.nav-offcanvas .offcanvas-title {
    display: block;
}
.nav-offcanvas .offcanvas-title .brand-logo {
    height: 40px;
}
.nav-offcanvas .btn-close {
    background: none;
    border: 0;
    color: var(--lavanda);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}
.nav-offcanvas .btn-close:hover { color: var(--panna); }
.nav-offcanvas .offcanvas-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem clamp(1.1rem, 4vw, 2rem) 2rem;
}
.nav-mobile-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.nav-mobile-list > li { border-bottom: 1px solid rgba(185, 175, 214, .1); }
.nav-mobile-list > li:not(.lang-switch) > a {
    display: block;
    padding: .9rem 0;
    color: var(--panna);
    font-weight: 500;
}
.nav-mobile-list > li:not(.lang-switch) > a:hover { color: var(--oro-soft); }
.nav-mobile-label {
    padding: 1.1rem 0 .3rem;
    font-family: var(--font-num);
    font-size: .72rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--oro);
    border-bottom: none !important;
}
.nav-mobile-list .lang-switch {
    padding: .9rem 0;
    gap: .6rem;
}

/* ---------- Footer ---------- */
.site-footer {
    border-top: 1px solid rgba(185, 175, 214, .12);
    padding-block: 3.2rem 2rem;
    margin-top: 3rem;
    color: var(--lavanda);
    font-size: .9rem;
    background: linear-gradient(180deg, transparent, rgba(18, 14, 42, .5));
}
.footer-grid {
    padding-bottom: 2.2rem;
    border-bottom: 1px solid rgba(185, 175, 214, .1);
}
.footer-brand {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}
.footer-logo {
    display: block;
    width: 240px;
    height: auto;
    flex: none;
    border-radius: var(--radius-sm);
}
.footer-tagline { line-height: 1.6; font-size: 1.15rem; }
.footer-col h4 {
    font-family: var(--font-num);
    font-size: .78rem;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--oro);
    margin-bottom: 1rem;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.footer-col a { color: var(--lavanda); }
.footer-col a:hover { color: var(--panna); }
.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 1rem;
    padding-top: 1.6rem;
}
.footer-bottom .disclaimer { opacity: .85; }
.footer-bottom .footer-rights { white-space: nowrap; opacity: .7; }
.footer-credits {  text-align: right; margin:0px; }

/* ---------- Form ---------- */
.field { display: block; margin-bottom: 1.15rem; }
.field label {
    display: block;
    font-size: .82rem;
    letter-spacing: .04em;
    color: var(--lavanda);
    margin-bottom: .4rem;
}
.field input {
    width: 100%;
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--indaco-600);
    background: rgba(255, 255, 255, .03);
    color: var(--panna);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color .2s, box-shadow .2s;
}
.field input::placeholder { color: rgba(185, 175, 214, .5); }
.field input:focus {
    outline: none;
    border-color: var(--oro);
    box-shadow: 0 0 0 3px rgba(232, 182, 90, .15);
}
.field textarea {
    display: block;
    padding: .85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--indaco-600);
    background: rgba(255, 255, 255, .03);
    color: var(--panna);
    font-family: var(--font-body);
    font-size: 1rem;
    resize: vertical;
    transition: border-color .2s, box-shadow .2s;
}
.field textarea::placeholder { color: rgba(185, 175, 214, .5); }
.field textarea:focus {
    outline: none;
    border-color: var(--oro);
    box-shadow: 0 0 0 3px rgba(232, 182, 90, .15);
}

/* Select coerenti con gli input, freccia custom (niente stile nativo) */
.field select {
    width: 100%;
    padding: .85rem 2.4rem .85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--indaco-600);
    background-color: rgba(255, 255, 255, .03);
    color: var(--panna);
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23E8B65A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
    transition: border-color .2s, box-shadow .2s;
}
.field select:focus {
    outline: none;
    border-color: var(--oro);
    box-shadow: 0 0 0 3px rgba(232, 182, 90, .15);
}
/* Le opzioni ereditano il tema scuro dal sistema */
.field select option { color: #111; }

/* Componente data di nascita: tre menu giorno / mese / anno
   (colonne Bootstrap: row + col-* in birthdate_selects(), qui solo lo
   stile dei singoli select, non il layout a colonne). */
.date-select select {
    width: 100%;
    padding: .85rem 2.4rem .85rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--indaco-600);
    background-color: rgba(255, 255, 255, .03);
    color: var(--panna);
    font-family: var(--font-body);
    font-size: 1rem;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23E8B65A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .9rem center;
    transition: border-color .2s, box-shadow .2s;
}
.date-select select:focus {
    outline: none;
    border-color: var(--oro);
    box-shadow: 0 0 0 3px rgba(232, 182, 90, .15);
}
.date-select select option { color: #111; }

/* ---------- Card generica (pannello) ---------- */
.panel {
    background: linear-gradient(160deg, var(--indaco-700), var(--indaco-800));
    border: 1px solid rgba(185, 175, 214, .12);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* ---------- Alert ---------- */
.alert-astral {
    border-radius: var(--radius-sm);
    padding: .9rem 1.1rem;
    margin-bottom: 1.2rem;
    border: 1px solid;
    font-size: .95rem;
}
.alert-astral.ok  { border-color: rgba(120, 220, 160, .4); background: rgba(120, 220, 160, .08); color: #bff0d2; }
.alert-astral.err { border-color: rgba(233, 130, 130, .4); background: rgba(233, 130, 130, .08); color: #f3c2c2; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-astral { margin-top: 2rem; }
.badge-owned {
    font-family: var(--font-num);
    font-size: .68rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #bff0d2;
    border: 1px solid rgba(120, 220, 160, .4);
    padding: .2rem .5rem;
    border-radius: 999px;
}

/* Accessibilità: rispetta la riduzione del movimento */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Responsive nav: sotto 820px il menu passa dai link+select
   all'apertura dell'offcanvas .nav-offcanvas (vedi sopra). ---------- */
@media (max-width: 820px) {
    .nav-toggle { display: block; }
    .nav-links { display: none; }
}

/* ---------- Toast di notifica (appare e scompare da solo) ---------- */
.flash-toast {
    position: fixed;
    top: 1.4rem;
    left: 50%;
    z-index: 200;
    max-width: min(90vw, 480px);
    padding: .9rem 1.6rem;
    border-radius: 999px;
    border: 1px solid rgba(120, 220, 160, .4);
    background: rgba(30, 26, 58, .96);
    color: #bff0d2;
    font-size: .92rem;
    text-align: center;
    box-shadow: 0 14px 40px -14px rgba(0, 0, 0, .6);
    transform: translate(-50%, -20px);
    opacity: 0;
    animation: flash-toast-in .3s var(--ease) forwards, flash-toast-out .4s var(--ease) 3.2s forwards;
}
@keyframes flash-toast-in {
    to { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes flash-toast-out {
    to { transform: translate(-50%, -20px); opacity: 0; }
}

/* ---------- Campo password con bottone "occhio" ---------- */
.password-wrap { position: relative; }
.password-wrap input { padding-right: 2.8rem; }
.password-toggle {
    position: absolute;
    top: 50%;
    right: .7rem;
    transform: translateY(-50%);
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--lavanda);
    cursor: pointer;
}
.password-toggle:hover { color: var(--oro); }
.password-toggle svg { width: 100%; height: 100%; }
.password-toggle .icon-eye-off { display: none; }
.password-toggle.is-visible .icon-eye { display: none; }
.password-toggle.is-visible .icon-eye-off { display: block; }

/* ---------- Feedback di attesa sui form dei tool (generazione AI) ---------- */
.tool-form.is-loading { opacity: .55; pointer-events: none; }
.tool-loading {
    display: flex;
    align-items: center;
    gap: .8rem;
    margin-top: 1.2rem;
    color: var(--lavanda);
}
.tool-loading-spinner {
    width: 22px;
    height: 22px;
    flex: none;
    border: 2px solid rgba(232, 182, 90, .25);
    border-top-color: var(--oro);
    border-radius: 50%;
    animation: tool-spin .8s linear infinite;
}
@keyframes tool-spin {
    to { transform: rotate(360deg); }
}
@media (prefers-reduced-motion: reduce) {
    .tool-loading-spinner { animation: none; }
}

/* ---------- Overlay di caricamento (navigazione con attesa: calendario
   lunare, anche dalla card del tool in homepage) ---------- */
.luna-loading-overlay {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center; gap: .8rem;
    background: rgba(18,14,42,.82); backdrop-filter: blur(3px);
    color: var(--panna); font-size: 1.05rem;
}
