/* SayNoMore - style.css
 *
 * Layout: single column, contenuto centrato orizzontalmente.
 * Niente footer "barra", niente position:fixed.
 * Il footer e' una semplice riga di testo discreta che chiude la card.
 */

/* Font display per il titolo: Chakra Petch self-hosted.
   File originali dal repo ufficiale Cadson Demak (SIL Open Font License 1.1):
   https://github.com/cadsondemak/Chakra-Petch
   Mantenere i file in fonts/ permette di NON contattare server esterni
   (niente Google Fonts), preservando la privacy del visitatore. */
@font-face {
    font-family: 'Chakra Petch';
    src: url('fonts/ChakraPetch-SemiBold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Chakra Petch';
    src: url('fonts/ChakraPetch-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-input:       #2A2F4A;
    --border-input:   #3B3F5C;
    --text-primary:   #E5E9F0;
    --text-secondary: #A5A8C5;
    --text-muted:     #6e7396;
    --blue-accent:    #4A76D9;
    --blue-hover:     #3B5FAA;
    --error-color:    #ff6b6b;
}

html {
    min-height: 100%;
}

body {
    min-height: 100vh;
    min-height: 100dvh; /* dvh = dynamic viewport height, esclude la barra
                           dell'indirizzo dinamica di Chrome Android e Safari
                           iOS. Evita scroll bar fantasma. Fallback a vh su
                           browser piu' vecchi. */
    font-family: Arial, sans-serif;
    color: var(--text-primary);
    background:
        linear-gradient(rgba(27, 31, 58, 0.55), rgba(27, 31, 58, 0.75)),
        url('background.webp');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;

    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}

.logo {
	display: block;
	margin: 0 auto 16px auto;
}
/* ---------- Card ---------- */
.container {
    width: 100%;
    max-width: 500px;
    background: rgba(35, 39, 67, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    padding: 2rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    /* margin-block auto + flex column su body centra verticalmente
       SOLO quando la card e' piu' corta del viewport.
       Su contenuti piu' alti, il margin auto degenera a 0 e la card
       parte naturalmente dall'alto (con padding del body). */
    margin: auto 0;
}

h1 {
    text-align: center;
    margin-bottom: 1.75rem;
    font-family: 'Chakra Petch', 'Segoe UI', system-ui, sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: linear-gradient(135deg, #ffffff 0%, #a5b8ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

h2 {
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ---------- Form fields ---------- */
textarea {
    width: 100%;
    height: 220px;
    padding: 0.875rem 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    font-family: inherit;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
    border-radius: 8px;
    resize: vertical;
    margin-bottom: 1rem;
    transition: border-color 0.15s ease;
}
textarea:focus {
    outline: none;
    border-color: var(--blue-accent);
}

.pw-input {
    width: 100%;
    height: 2.875rem;
    padding: 0 1rem;
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
    border-radius: 8px;
    margin-bottom: 1rem;
    transition: border-color 0.15s ease;
}
.pw-input:focus {
    outline: none;
    border-color: var(--blue-accent);
}
input.pw-input {
    text-align: left;
}

/* Select con freccia custom (CSP-safe, no asset esterni) */
select.pw-input {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    height: 2.875rem;
    padding: 0 2.5rem 0 1rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%23A5A8C5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='1,1 6,7 11,1'/></svg>");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 0.75rem;
    cursor: pointer;
}
select.pw-input::-ms-expand { display: none; }

.field-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Riga checkbox per "Notificami via email" in index.php. Layout flex
 * cosi' il box e l'etichetta restano allineati e cliccabili come un
 * unico target (il <label> wrappa entrambi). */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.checkbox-row input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--blue-accent);
    cursor: pointer;
    flex-shrink: 0;
}
.checkbox-row span {
    line-height: 1.35;
}

.secret-box {
    width: 100%;
    min-height: 180px;
    padding: 1rem;
    font-size: 0.95rem;
    line-height: 1.5;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
    border-radius: 8px;
    resize: vertical;
}

/* ---------- Buttons ---------- */
button {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    text-align: center;
    background: var(--blue-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}
button:hover {
    background: var(--blue-hover);
}
button:active {
    transform: translateY(1px);
}
button.generate {
    width: 100%;
    padding: 0.875rem 1.25rem;
    margin-top: 0.5rem;
}

/* ---------- Link box ---------- */
.link-box {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 1rem;
}
.link-box input {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    font-family: ui-monospace, "Cascadia Code", "Source Code Pro", Menlo, Consolas, monospace;
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-input);
    border-radius: 8px;
}
.link-box button {
    align-self: stretch;
}

/* ---------- Misc ---------- */
.info-text {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.actions {
    margin-top: 1.25rem;
}
.actions button {
    width: 100%;
}

.error-text {
    color: var(--error-color);
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* Override autofill Chrome/Edge */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset !important;
    -webkit-text-fill-color: var(--text-primary) !important;
    caret-color: var(--text-primary);
    transition: background-color 9999s ease-out;
}

/* ---------- Footer ---------- */
/*
 * Riga di testo discreta sotto la card. Niente position:fixed, niente
 * barre full-width, niente blur. Si comporta come una caption della card.
 * Lo wrapper full-width perche' il body e' display:flex column;
 * gli diamo flex:none cosi' non si stira oltre il contenuto.
 */
footer {
    width: 100%;
    max-width: 500px;
    padding: 1.25rem 1rem 0.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    flex: none;
}
footer a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid rgba(165, 168, 197, 0.3);
    transition: color 0.15s ease, border-color 0.15s ease;
}
footer a:hover {
    color: var(--text-primary);
    border-bottom-color: var(--text-primary);
}

/* ---------- Mobile ---------- */
@media (max-width: 500px) {
    body {
        padding: 1rem 0.75rem;
    }
    .container {
        padding: 1.5rem 1.25rem;
        border-radius: 10px;
    }
    h1 {
        font-size: 1.875rem;
        margin-bottom: 1.25rem;
    }
    textarea {
        height: 180px;
    }
    footer {
        padding: 1rem 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
}
