/* ============================================================
   Bando Giacomo — La Mongolfiera ODV
   Design system allineato a lamongolfieraonlus.it
   Palette Avada del sito · Raleway (titoli) + Montserrat (testo)
   ============================================================ */

:root {
    --primary: #ed5f0e;
    --primary-dark: #c94f0a;
    --primary-soft: #fdf3ec;
    --dark: #262e44;
    --info: #408292;
    --info-soft: #eaf3f5;
    --error: #ed6967;
    --error-soft: #fdf0f0;
    --success: #65bc7b;
    --success-soft: #eef8f1;
    --warning: #e6a23c;
    --warning-soft: #fdf6ec;
    --text: #3a3f42;
    --muted: #5c6668;
    --border: #e5e5e5;
    --bg: #f9f9f9;
    --white: #ffffff;
    --shadow: 0 2px 12px rgba(38, 46, 68, 0.08);
    --shadow-lg: 0 6px 28px rgba(38, 46, 68, 0.10);
    --radius: 12px;
    --radius-sm: 8px;
    --font-title: 'Raleway', 'Segoe UI', sans-serif;
    --font-body: 'Montserrat', 'Segoe UI', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-family: var(--font-title);
    color: var(--dark);
    line-height: 1.3;
}

a { color: var(--info); }

/* ---------- HEADER ---------- */
.header {
    background: var(--white);
    border-bottom: 3px solid var(--primary);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    box-shadow: 0 1px 6px rgba(38, 46, 68, 0.06);
}

.header-brand { display: flex; align-items: center; gap: 12px; }

.header-logo-img { height: 52px; width: auto; }

.header-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 17px;
    color: var(--dark);
}

.header-sub { font-size: 12px; color: var(--muted); }

.header-nav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.header-user { font-size: 13px; color: var(--muted); }

.btn-logout {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
    border: 1.5px solid var(--border);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    transition: all .15s;
}
.btn-logout:hover { border-color: var(--primary); color: var(--primary); }

.badge-deadline {
    background: var(--primary-soft);
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge-deadline.closed { background: var(--error-soft); color: var(--error); }

/* ---------- LAYOUT ---------- */
.container { max-width: 860px; width: 100%; margin: 32px auto; padding: 0 20px; flex: 1; }
.container-wide { max-width: 1200px; width: 100%; margin: 32px auto; padding: 0 20px; flex: 1; }

.main-public {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 20px;
    background: linear-gradient(160deg, var(--primary-soft) 0%, var(--bg) 60%);
}

/* ---------- LOGIN SPLIT (orizzontale, stile moderno) ---------- */
.auth-split {
    flex: 1;
    display: flex;
    min-height: 100vh;
}

.auth-hero {
    flex: 1 1 44%;
    background:
        radial-gradient(1100px 500px at 15% 0%, rgba(237,95,14,0.28), transparent 60%),
        linear-gradient(150deg, #2e3653 0%, var(--dark) 55%, #1d2438 100%);
    color: #fff;
    display: flex;
    align-items: center;
    padding: 56px 6vw;
}

.auth-hero-inner { max-width: 440px; }

.auth-hero-logo {
    display: inline-flex;
    background: #fff;
    border-radius: 16px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.25);
    margin-bottom: 26px;
}
.auth-hero-logo img { height: 56px; width: auto; display: block; }

.auth-hero-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 34px;
    line-height: 1.15;
    color: #fff;
    margin-bottom: 14px;
}

.auth-hero-sub { font-size: 15.5px; line-height: 1.6; color: rgba(255,255,255,0.82); margin-bottom: 26px; }

.auth-hero-points { list-style: none; margin: 0 0 30px; }
.auth-hero-points li {
    position: relative;
    padding-left: 30px;
    margin-bottom: 13px;
    font-size: 14.5px;
    color: rgba(255,255,255,0.92);
}
.auth-hero-points li::before {
    content: '✓';
    position: absolute;
    left: 0; top: -1px;
    width: 21px; height: 21px;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    font-size: 12px;
    line-height: 21px;
    text-align: center;
    font-weight: 700;
}

.auth-hero-org {
    font-size: 13px;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    border-top: 1px solid rgba(255,255,255,0.15);
    padding-top: 18px;
}

.auth-panel {
    flex: 1 1 56%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: var(--white);
    overflow-y: auto;
}

/* Nella colonna form il logo è già nel pannello brand a sinistra */
.auth-panel .login-box {
    box-shadow: none;
    border-top: none;
    border-radius: 0;
    padding: 0;
    max-width: 380px;
}
.auth-panel .login-logo-img { display: none; }
.auth-panel .login-title { font-size: 22px; }
.auth-panel .login-subtitle { margin-bottom: 22px; }

@media (max-width: 860px) {
    .auth-split { flex-direction: column; min-height: 0; }
    .auth-hero {
        flex: none;
        padding: 30px 24px;
        align-items: flex-start;
    }
    .auth-hero-inner { max-width: none; }
    .auth-hero-title { font-size: 25px; margin-bottom: 10px; }
    .auth-hero-sub { font-size: 14px; margin-bottom: 16px; }
    .auth-hero-points { display: none; }
    .auth-hero-org { display: none; }
    .auth-hero-logo { height: auto; margin-bottom: 18px; padding: 9px 13px; }
    .auth-hero-logo img { height: 42px; }
    .auth-panel { padding: 28px 20px; }
    .auth-panel .login-box { max-width: 420px; width: 100%; }
}

.footer {
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
    padding: 20px;
    border-top: 1px solid var(--border);
    background: var(--white);
}
.footer a { color: var(--info); }

/* ---------- LOGIN / PAGINE PUBBLICHE ---------- */
.login-box {
    background: var(--white);
    border-radius: 14px;
    border-top: 4px solid var(--primary);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 24px 30px 26px;
    text-align: center;
}

.login-logo-img { height: 58px; width: auto; margin-bottom: 6px; }

.login-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 19px;
    color: var(--dark);
}

.login-subtitle { font-size: 13px; color: var(--muted); margin: 4px 0 18px; }

.login-footer { font-size: 12.5px; color: var(--muted); margin-top: 16px; }

/* ---------- CARD ---------- */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 26px 28px;
    margin-bottom: 22px;
}

.card-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 18px;
    color: var(--dark);
    margin-bottom: 4px;
}

.card-subtitle { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }

.status-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 44px 30px;
    text-align: center;
}

.status-icon { font-size: 42px; margin-bottom: 10px; }

.status-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 19px;
    color: var(--dark);
    margin-bottom: 8px;
}

/* ---------- STATISTICHE ADMIN ---------- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
    border-top: 3px solid var(--primary);
}
.stat-box.green { border-top-color: var(--success); }
.stat-box.blue { border-top-color: var(--info); }

.stat-value { font-family: var(--font-title); font-size: 32px; font-weight: 800; color: var(--dark); }
.stat-label { font-size: 12.5px; color: var(--muted); }

/* ---------- FORM ---------- */
.form-group { margin-bottom: 18px; text-align: left; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.form-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 5px;
}

.req { color: var(--primary); }

input[type="text"], input[type="email"], input[type="password"], input[type="date"],
input[type="number"], input[type="tel"], select, textarea {
    width: 100%;
    padding: 10px 13px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14.5px;
    font-family: var(--font-body);
    color: var(--text);
    background: var(--white);
    transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(237, 95, 14, 0.12);
}

input.error, select.error, textarea.error {
    border-color: var(--error);
    background: var(--error-soft);
}

.field-error { font-size: 12.5px; color: var(--error); margin-top: 4px; }

textarea {
    resize: vertical;
    min-height: 96px;
    white-space: pre-wrap;      /* va a capo mantenendo gli invii digitati */
    overflow-wrap: break-word;  /* spezza anche le parole troppo lunghe */
    word-break: break-word;
}

.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.check-row { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; text-align: left; }
.check-row input { width: auto; margin-top: 3px; }
.check-row label { margin: 0; font-weight: 500; }

/* ---------- PULSANTI ---------- */
.btn {
    display: inline-block;
    padding: 11px 22px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-body);
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all .15s;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 3px 10px rgba(237, 95, 14, 0.30);
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
    background: var(--white);
    color: var(--primary);
    border: 1.5px solid var(--primary);
}
.btn-secondary:hover { background: var(--primary-soft); }

.btn-ghost {
    background: var(--white);
    color: var(--muted);
    border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--muted); }

.btn-danger { background: var(--error); color: var(--white); }
.btn-danger:hover { background: #d95553; }

.btn-sm { padding: 6px 13px; font-size: 12.5px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ---------- ALERT ---------- */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: 18px;
    text-align: left;
}
.alert-error   { background: var(--error-soft);   color: #b34240; border-left: 4px solid var(--error); }
.alert-success { background: var(--success-soft); color: #3e7a4e; border-left: 4px solid var(--success); }
.alert-warning { background: var(--warning-soft); color: #9a6b1e; border-left: 4px solid var(--warning); }
.alert-info    { background: var(--info-soft);    color: #2f6270; border-left: 4px solid var(--info); }
.alert ul { margin: 6px 0 0 18px; }

/* ---------- BADGE DI STATO ---------- */
.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge-bozza        { background: #f0f0f0; color: var(--muted); }
.badge-inviata      { background: var(--info-soft); color: var(--info); }
.badge-in_revisione { background: var(--warning-soft); color: #9a6b1e; }
.badge-approvata    { background: var(--success-soft); color: #3e7a4e; }
.badge-rifiutata    { background: var(--error-soft); color: #b34240; }

/* ---------- WIZARD ---------- */
.steps {
    display: flex;
    gap: 2px;
    margin-bottom: 22px;
}

.step {
    flex: 1;
    text-align: center;
    text-decoration: none;
    position: relative;
}

.step-dot {
    display: block;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--border);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    line-height: 30px;
    margin: 0 auto;
    transition: all .15s;
}

.step-label {
    font-size: 11px;
    color: var(--muted);
    margin-top: 4px;
    display: block;
}

.step.done .step-dot { background: var(--success); color: var(--white); }
.step.done .step-label { color: var(--success); }

.step.current .step-dot {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.step.current .step-label { color: var(--primary); font-weight: 700; }

a.step.done:hover .step-dot { box-shadow: 0 0 0 4px var(--success-soft); }

.wizard-section-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 19px;
    color: var(--dark);
    margin-bottom: 4px;
}

.wizard-section-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 20px; }

/* ---------- TABELLE ---------- */
table { width: 100%; border-collapse: collapse; }

th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    padding: 12px 14px;
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    vertical-align: middle;
    overflow-wrap: break-word;
    word-break: break-word;
}

tr:last-child td { border-bottom: none; }

.summary-table { table-layout: fixed; width: 100%; }
.summary-table td { padding: 9px 12px; font-size: 13.5px; vertical-align: top; }
.summary-table td:first-child { font-weight: 600; color: var(--muted); width: 42%; }

/* ---------- TIMELINE (storico stati) ---------- */
.timeline { list-style: none; margin-top: 8px; }

.timeline li {
    position: relative;
    padding: 0 0 16px 24px;
    border-left: 2px solid var(--border);
    margin-left: 8px;
    font-size: 13.5px;
}
.timeline li:last-child { padding-bottom: 4px; border-left-color: transparent; }

.timeline li::before {
    content: '';
    position: absolute;
    left: -7px;
    top: 3px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 1.5px var(--primary);
}

.timeline .when { color: var(--muted); font-size: 12px; }

/* ---------- ALLEGATI ---------- */
.upload-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f0;
    flex-wrap: wrap;
}
.upload-row:last-child { border-bottom: none; }

.upload-info { flex: 1; min-width: 220px; }
.upload-name { font-weight: 600; font-size: 14px; color: var(--dark); }
.upload-status { font-size: 12.5px; margin-top: 2px; }
.upload-status.ok { color: var(--success); }
.upload-status.missing { color: var(--muted); }

/* ---------- TAB ADMIN ---------- */
.tab-nav { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; }

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---------- MODALE APPLICATIVA ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(38, 46, 68, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}
.modal-overlay.open { display: flex; }

.modal-card {
    background: var(--white);
    border-radius: 14px;
    border-top: 4px solid var(--primary);
    box-shadow: 0 12px 48px rgba(38, 46, 68, 0.25);
    max-width: 440px;
    width: 100%;
    padding: 26px 28px;
    animation: modalIn .18s ease-out;
}
@keyframes modalIn {
    from { transform: translateY(10px) scale(.98); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.modal-title {
    font-family: var(--font-title);
    font-weight: 800;
    font-size: 17px;
    color: var(--dark);
    margin-bottom: 8px;
}

.modal-text { font-size: 14.5px; color: var(--text); line-height: 1.6; white-space: pre-line; }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

/* ---------- CHECKLIST DI COMPLETAMENTO ---------- */
.checklist { list-style: none; margin: 4px 0; }
.checklist li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    border-bottom: 1px solid #f2f2f2;
}
.checklist li:last-child { border-bottom: none; }
.checklist .ck {
    width: 22px; height: 22px; border-radius: 50%;
    font-size: 12px; line-height: 22px; text-align: center;
    flex-shrink: 0; font-weight: 700;
}
.checklist .ck.ok { background: var(--success); color: var(--white); }
.checklist .ck.todo { background: var(--border); color: var(--muted); }
.checklist .spacer { flex: 1; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .header { padding: 10px 16px; }
    .header-logo-img { height: 40px; }
    .header-sub { display: none; }
    .header-user { display: none; }
    .header-nav { gap: 8px; }
    .container, .container-wide { margin: 20px auto; }
    .card { padding: 20px 18px; }
    .step-label { display: none; }
    .step.current .step-label { display: block; position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; }
    .steps { margin-bottom: 34px; }
    .btn-row { flex-direction: column-reverse; align-items: stretch; }
    .btn-row > div { display: flex; flex-direction: column; gap: 10px; }
    table { display: block; overflow-x: auto; }
}
