/* =========================================================
   Gym Manager — Custom Styles
   Stile pulito, moderno e orientato a utenti non tecnici.
   ========================================================= */

:root {
    --gm-primary: #0f6b4f;
    --gm-primary-dark: #0b543e;
    --gm-bg: #f3f6f9;
    --gm-card-radius: 0.9rem;
}

body {
    background-color: var(--gm-bg);
    font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
    min-height: 100vh;
}

/* Navbar */
.navbar-dark.bg-dark {
    background: linear-gradient(90deg, #14213d 0%, #0f3d2e 100%) !important;
}

.navbar-brand {
    font-weight: 800;
    letter-spacing: -0.4px;
    font-size: 1.2rem;
}

.navbar .nav-link {
    font-size: 0.95rem;
    border-radius: 0.4rem;
    padding: 0.45rem 0.75rem !important;
}

.navbar .nav-link:hover {
    background: rgba(255,255,255,0.08);
}

/* Card */
.card {
    border: 1px solid rgba(0,0,0,0.04);
    border-radius: var(--gm-card-radius);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.card:hover {
    box-shadow: 0 0.6rem 1.2rem rgba(15, 23, 42, 0.12);
}

.card-header {
    font-weight: 600;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background-color: rgba(0,0,0,0.015);
}

/* Headings */
h1, h2, h3, h4, h5 {
    font-weight: 700;
    letter-spacing: -0.3px;
}

h1 {
    font-size: 1.7rem;
}

/* Buttons */
.btn {
    border-radius: 0.55rem;
}

.btn-lg {
    border-radius: 0.7rem;
}

/* Tables */
.table {
    --bs-table-hover-bg: rgba(15, 107, 79, 0.04);
}

.table thead th {
    border-top: none;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #64748b;
    font-weight: 700;
    background: rgba(0,0,0,0.015);
}

.table td {
    vertical-align: middle;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.45em 0.7em;
    border-radius: 0.5rem;
}

/* Alerts */
.alert {
    border-radius: 0.8rem;
    border: none;
}

/* Forms */
.form-control, .form-select {
    border-radius: 0.6rem;
    border-color: #d1d9e0;
}

.form-control:focus, .form-select:focus {
    border-color: var(--gm-primary);
    box-shadow: 0 0 0 0.2rem rgba(15, 107, 79, 0.12);
}

/* Help button ("i") — bersaglio da tocco 44px (guida di stile, articolo 1):
   il bottone è un cerchio grande come il dito, il glifo resta centrato. */
.btn-help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 50%;
    border: none;
    background: #e2e8f0;
    color: #334155;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    vertical-align: middle;
}

.btn-help:hover {
    background: var(--gm-primary);
    color: #fff;
}

/* Page header helper */
.page-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Empty states */
.empty-state {
    color: #94a3b8;
    text-align: center;
    padding: 2rem 1rem;
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

/* Codice fiscale sempre maiuscolo */
input[name="codice_fiscale"] {
    text-transform: uppercase;
}

/* Login */
.auth-wrapper {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #eef2f7 0%, #dbe7e1 100%);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
}

/* Calendar / cards */
.slot-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.slot-card:hover {
    transform: translateY(-2px);
}

/* Footer spacing */
main, .container-fluid.mt-3 {
    padding-bottom: 2rem;
}

/* Auth pages (base dedicata auth_base.html) */
.auth-page .auth-wrapper {
    position: relative;
}

.auth-logo {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--gm-primary, #0f6b4f) 0%, #0b4d37 100%);
    color: #fff;
    box-shadow: 0 0.4rem 1rem rgba(15, 107, 79, 0.25);
}

.auth-card {
    border-radius: 1rem;
}

.auth-page .form-control:focus,
.auth-page .form-check-input:focus {
    box-shadow: 0 0 0 0.2rem rgba(15, 107, 79, 0.15);
    border-color: var(--gm-primary, #0f6b4f);
}

/* --- Popup di aiuto (#helpModalBody) ------------------------------------------------
   I contenuti arrivano da `data-help-body` e passano da un sanitizzatore che, per
   sicurezza, **cancella tutti gli attributi** (niente classi, niente stili inline). La
   struttura si può quindi dare solo da qui: senza queste regole i titoli di sezione
   (`h6`) hanno la stessa dimensione del testo e l'aiuto lungo diventa un muro.
   Vale per tutti i popup dell'applicazione, non solo per quello del modulo di incasso. */
#helpModalBody h4,
#helpModalBody h5,
#helpModalBody h6 {
    margin-top: 1.1rem;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 1.02rem;
    color: #0f172a;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e2e8f0;
}

#helpModalBody h6:first-child,
#helpModalBody h5:first-child,
#helpModalBody h4:first-child {
    margin-top: 0;
}

#helpModalBody ul,
#helpModalBody ol {
    margin-bottom: 0.5rem;
}

#helpModalBody li {
    margin-bottom: 0.35rem;
}

#helpModalBody p {
    margin-bottom: 0.6rem;
}

/* =========================================================
   Guida di stile — articolo 1: i bersagli da tocco.
   Ogni azione toccabile dal telefono ha almeno 44px di lato
   minimo (WCAG 2.2 / target-size). `.btn-touch` è la classe
   da usare sui pulsanti delle aree socio e trainer.
   ========================================================= */
.btn-touch {
    min-height: 44px;
    min-width: 44px;
}

/* Il toggle della navbar (56x40) arrivava a 44 solo in larghezza: l'altezza si
   corregge qui, senza toccare il template condiviso di coord. */
.navbar-toggler {
    min-height: 44px;
}

/* =========================================================
   Guida di stile — articolo 2: la barra d'azione mobile.
   L'azione più frequente sta nel thumb zone senza scorrere:
   fissa in basso su telefono, assente su desktop (dove il
   tasto vive nella sua sezione).
   ========================================================= */
.barra-azione-mobile {
    position: fixed;
    inset: auto 0 0 0;
    padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #e2e8f0;
    z-index: 1030;
}

@media (min-width: 768px) {
    .barra-azione-mobile {
        display: none !important;
    }
}

/* Spazio per la barra fissa: solo sulle pagine che la usano. */
.pagina-home {
    padding-bottom: 5.5rem;
}

@media (min-width: 768px) {
    .pagina-home {
        padding-bottom: 0;
    }
}
