/* ============================================================
   style.css — SOS App — Tema bianco
   Colori: sfondo #fff, rosso emergenza #DC2626, testo #111
   Font: Inter (Google Fonts)
   ============================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: #ffffff;
    color: #111;
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============================================================
   LAYOUT GLOBALE
   ============================================================ */

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 16px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 24px;
    border-bottom: 1px solid #e4e4e7;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111;
    letter-spacing: -0.02em;
}

.page-header .user-badge {
    font-size: 0.8rem;
    color: #888;
    margin-top: 2px;
}

/* ============================================================
   PULSANTI GENERICI
   ============================================================ */

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 64px;
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.btn:active {
    transform: scale(0.97);
    opacity: 0.85;
}

.btn-red {
    background-color: #DC2626;
    color: #fff;
}

.btn-red:hover {
    background-color: #b91c1c;
}

.btn-dark {
    background-color: #f9fafb;
    color: #111;
    border: 1px solid #e4e4e7;
}

.btn-dark:hover {
    background-color: #f3f4f6;
}

.btn-logout {
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    background-color: #f9fafb;
    color: #666;
    border: 1px solid #e4e4e7;
    width: auto;
}

.btn-logout:hover {
    color: #DC2626;
    border-color: #DC2626;
}

/* ============================================================
   SEZIONI
   ============================================================ */

.section {
    margin-bottom: 28px;
}

.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 12px;
    padding-left: 2px;
}

/* ============================================================
   PAGINA LOGIN
   ============================================================ */

.login-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 32px 16px 24px;
    overflow-y: auto;
}

.login-logo {
    font-size: 2.2rem;
    margin-bottom: 6px;
}

.login-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #DC2626;
    margin-bottom: 4px;
}

.login-subtitle {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 28px;
    text-align: center;
}

/* Selezione utente */
.user-select {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    width: 100%;
    max-width: 380px;
    margin-bottom: 24px;
}

.user-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 90px;
    padding: 14px;
    border-radius: 16px;
    background-color: #f9fafb;
    border: 2px solid #e4e4e7;
    color: #111;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.user-btn .user-emoji {
    font-size: 1.8rem;
    line-height: 1;
}

.user-btn:active {
    transform: scale(0.96);
}

.user-btn.selected,
.user-btn:hover {
    border-color: #DC2626;
    background-color: #fef2f2;
}

/* Form PIN */
.pin-form {
    width: 100%;
    max-width: 320px;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: fadeIn 0.25s ease;
}

.pin-form.visible {
    display: flex;
}

.pin-label {
    font-size: 0.8rem;
    color: #888;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.pin-user-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: #DC2626;
}

/* Display PIN (pallini) */
.pin-display {
    display: flex;
    gap: 12px;
    justify-content: center;
    height: 20px;
    align-items: center;
}

.pin-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 2px solid #d4d4d8;
    background-color: transparent;
    transition: background-color 0.15s;
}

.pin-dot.filled {
    background-color: #DC2626;
    border-color: #DC2626;
}

/* Tastiera numerica */
.pin-keyboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    width: 100%;
}

.pin-key {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 60px;
    border-radius: 12px;
    background-color: #f9fafb;
    border: 1px solid #e4e4e7;
    color: #111;
    font-family: 'Inter', sans-serif;
    font-size: 1.3rem;
    font-weight: 500;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.1s, transform 0.08s;
    user-select: none;
}

.pin-key:active {
    background-color: #e5e7eb;
    transform: scale(0.94);
}

.pin-key.key-0 {
    grid-column: 2;
}

.pin-key.key-del {
    background-color: #fef2f2;
    border-color: #fecaca;
    font-size: 1.1rem;
    color: #DC2626;
}

.pin-key.key-submit {
    background-color: #DC2626;
    border-color: #DC2626;
    font-size: 0.9rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: 0.04em;
}

.pin-key.key-submit:active {
    background-color: #b91c1c;
}

.pin-hidden-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 1px;
    height: 1px;
}

/* Errore login */
.login-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.9rem;
    color: #DC2626;
    width: 100%;
    text-align: center;
}

/* Torna indietro */
.back-link {
    font-size: 0.85rem;
    color: #aaa;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    background: none;
    border: none;
    font-family: 'Inter', sans-serif;
}

.back-link:hover {
    color: #666;
}

/* ============================================================
   RUBRICA EMERGENZA
   ============================================================ */

.contact-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    padding: 14px 18px;
    border-radius: 14px;
    background-color: #f9fafb;
    border: 1px solid #e4e4e7;
    color: #111;
    text-decoration: none;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.contact-btn:active {
    transform: scale(0.98);
    background-color: #fef2f2;
    border-color: #DC2626;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.contact-name {
    font-size: 1rem;
    font-weight: 600;
}

.contact-number {
    font-size: 0.85rem;
    color: #888;
    font-variant-numeric: tabular-nums;
}

.contact-icon {
    display: flex;
    align-items: center;
    color: #DC2626;
}

/* ============================================================
   SEZIONE MEDICA
   ============================================================ */

.medical-card {
    background-color: #fef2f2;
    border: 2px solid #DC2626;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.medical-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.medical-header .med-icon {
    font-size: 1.6rem;
}

.medical-header h2 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #DC2626;
    letter-spacing: 0.02em;
}

.medical-header .med-subtitle {
    font-size: 0.75rem;
    color: #dc2626;
    letter-spacing: 0.06em;
}

.medical-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 12px;
    border-bottom: 1px solid #fecaca;
}

.medical-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.medical-label {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #dc2626;
}

.medical-value {
    font-size: 1rem;
    font-weight: 600;
    color: #111;
    line-height: 1.4;
}

.medical-value.large {
    font-size: 1.3rem;
    font-weight: 800;
}

.emergency-note {
    background-color: #DC2626;
    border-radius: 10px;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    line-height: 1.5;
}

.emergency-note .note-en {
    font-style: italic;
    font-weight: 400;
    color: #fecaca;
    font-size: 0.9rem;
}

/* ============================================================
   SEZIONE DOCUMENTI
   ============================================================ */

.doc-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.doc-info-item {
    background-color: #f9fafb;
    border: 1px solid #e4e4e7;
    border-radius: 12px;
    padding: 12px 14px;
}

.doc-info-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #aaa;
    margin-bottom: 4px;
}

.doc-info-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: #111;
}

.doc-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.doc-download-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 14px 18px;
    border-radius: 14px;
    background-color: #f9fafb;
    border: 1px solid #e4e4e7;
    color: #111;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.doc-download-btn:active {
    transform: scale(0.98);
    background-color: #f3f4f6;
}

.doc-download-btn .doc-icon {
    font-size: 1.4rem;
}

.doc-download-btn .doc-arrow {
    margin-left: auto;
    color: #bbb;
    font-size: 1rem;
}

/* ============================================================
   PULSANTE POSIZIONE
   ============================================================ */

.location-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 64px;
    padding: 14px 20px;
    border-radius: 14px;
    background-color: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #2563eb;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    width: 100%;
}

.location-btn:active {
    transform: scale(0.98);
    background-color: #dbeafe;
}

/* ============================================================
   NOTE LIBERE
   ============================================================ */

.notes-card {
    background-color: #f9fafb;
    border: 1px solid #e4e4e7;
    border-radius: 14px;
    padding: 16px;
    font-size: 0.95rem;
    color: #444;
    line-height: 1.6;
    white-space: pre-wrap;
}

/* ============================================================
   COMING SOON (Marco)
   ============================================================ */

.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    gap: 16px;
}

.coming-soon .cs-icon {
    font-size: 3rem;
}

.coming-soon h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #111;
}

.coming-soon p {
    font-size: 0.9rem;
    color: #aaa;
}

/* ============================================================
   SOS WHATSAPP
   ============================================================ */

.sos-wa-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 72px;
    padding: 16px 20px;
    border-radius: 16px;
    border: none;
    color: #fff;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    transition: background-color 0.15s, transform 0.1s;
    margin-bottom: 10px;
}

.sos-wa-btn:last-child {
    margin-bottom: 0;
}

.sos-wa-btn.sos-rubato {
    background-color: #DC2626;
}

.sos-wa-btn.sos-rubato:active {
    background-color: #b91c1c;
    transform: scale(0.97);
}

.sos-wa-btn.sos-persa {
    background-color: #ea580c;
}

.sos-wa-btn.sos-persa:active {
    background-color: #c2410c;
    transform: scale(0.97);
}

.sos-wa-btn:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.sos-wa-svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.sos-wa-text {
    font-size: 1rem;
    font-weight: 700;
    text-align: left;
    line-height: 1.3;
}

/* ============================================================
   ANIMAZIONI
   ============================================================ */

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============================================================
   UTILITY
   ============================================================ */

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-red { color: #DC2626; }
.text-muted { color: #888; }
.text-center { text-align: center; }
.w-full { width: 100%; }

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 360px) {
    .doc-info-grid {
        grid-template-columns: 1fr;
    }
    .pin-key {
        min-height: 52px;
        font-size: 1.1rem;
    }
    .user-btn {
        min-height: 76px;
    }
}
