/* ==========================================================================
   GLOBAL.CSS - Skylearn Design System Core
   Palette: Sky, Sun, Leaf, Coral, Berry, Surface & Ink
   Typography: Nunito (Display) & Atkinson Hyperlegible (Body)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Atkinson+Hyperlegible:ital,wght@0,400;0,700;1,400;1,700&family=Nunito:wght@600;700;800;900&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
    /* --- 1. LOTTA CLUB SEGGIANO PALETTE (Colori Ufficiali Palestra) --- */
    /* Blu Palestra (Ala destra dello scudetto) */
    --club-blue: #0056D2;
    --club-blue-bright: #2B7DF7;
    --club-blue-deep: #003B99;
    --club-blue-soft: #EBF3FF;

    /* Rosso Palestra (Ala sinistra dello scudetto) */
    --club-red: #E11D48;
    --club-red-bright: #F43F5E;
    --club-red-deep: #9F1239;
    --club-red-soft: #FFE4E6;

    /* Arancione Palestra (Bordo scudo e scritta Lotta Club Seggiano) */
    --club-orange: #FF7700;
    --club-orange-bright: #FF9233;
    --club-orange-deep: #C75500;
    --club-orange-soft: #FFF1E5;

    /* Blu Notte Scudo (Sfondo profondo dello scudetto) */
    --club-navy: #060B24;
    --club-navy-surface: #0E1638;

    /* Mappature di Sistema (Skylearn integrato con i colori del club) */
    --sky: var(--club-blue);
    --sky-bright: var(--club-blue-bright);
    --sky-deep: var(--club-blue-deep);
    --sky-soft: var(--club-blue-soft);

    /* Arancione per trofei, chip peso, badge gara ed elementi in risalto */
    --sun: var(--club-orange);
    --sun-bright: var(--club-orange-bright);
    --sun-deep: var(--club-orange-deep);
    --sun-soft: var(--club-orange-soft);

    /* Verde per conferme e successo (Tricolore dello scudetto) */
    --leaf: #16A34A;
    --leaf-bright: #22C55E;
    --leaf-deep: #15803D;
    --leaf-soft: #DCFCE7;

    /* Rosso per avvisi, eliminazioni e cancellazioni */
    --coral: var(--club-red);
    --coral-deep: var(--club-red-deep);
    --coral-soft: var(--club-red-soft);

    /* Berry per accenti speciali */
    --berry: #8B5CF6;
    --berry-soft: #EDE9FE;

    /* Sfondi e Superfici */
    --bg-base: #FFFFFF;             /* Background: Bianco puro */
    --bg-panel: #F8FAFC;            /* Surface: Grigio-azzurrino chiarissimo */
    --bg-elevated: #FFFFFF;         /* Surface Elevated: Card in risalto e modali */
    --bg-input: #F1F5F9;            /* Surface Sunken: Campi input */

    /* Typography / Ink */
    --ink: #060B24;                 /* Primary text: navy profondo dello scudetto */
    --ink-muted: #475569;           /* Secondary text, instructions */
    --ink-subtle: #94A3B8;          /* Metadata, timestamps */
    --ink-faint: #CBD5E1;           /* Disabled state, placeholder */

    /* Aliases for Existing Semantic Names */
    --text-title: var(--ink);
    --text-main: #1E293B;
    --text-muted: var(--ink-muted);
    --text-faint: var(--ink-faint);

    /* Outlines & Borders */
    --outline: #E2E8F0;             /* Outline: Card edges, dividers */
    --outline-strong: #94A3B8;      /* Outline Strong: Focus rings, prominent separators */
    --border-color: var(--outline);
    --border-hover: #CBD5E1;

    /* Accent System Mapping */
    --accent-main: var(--sky);
    --accent-hover: var(--sky-deep);
    --accent-bg-soft: var(--sky-soft);

    /* Status Notifications */
    --error-bg: var(--coral-soft);
    --error-border: rgba(248, 113, 113, 0.4);
    --error-text: #B91C1C;

    --success-bg: var(--leaf-soft);
    --success-border: rgba(34, 197, 94, 0.35);
    --success-text: var(--leaf-deep);

    /* Soft Friendly Elevation */
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.02);
    --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.06);     /* Card hover lift */
    --shadow-lg: 0 12px 32px rgba(59, 130, 246, 0.15);   /* Active card shadow */
    --shadow-modal: 0 24px 48px rgba(15, 23, 42, 0.12); /* Modal wash */

    /* Skylearn Generous Rounded Radii */
    --radius-xs: 8px;      /* Small tags & chips */
    --radius-sm: 12px;     /* Inputs */
    --radius-md: 16px;     /* Buttons (pill-friendly) */
    --radius-lg: 20px;     /* Cards */
    --radius-xl: 28px;     /* Modals & large panels */
    --radius-pill: 999px;  /* Avatar circles, pills, streak counters */

    /* Typography */
    --font-display: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

/* --- 2. RESET E TIPOGRAFIA BASE --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--text-title);
    line-height: 1.25;
    font-weight: 800;
}

/* --- 3. MODULI (Forms, Input e Label) --- */
form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.row2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-muted);
    letter-spacing: 0.02em;
}

.field input,
.field select,
.textarea-custom {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-size: 16px;
    font-family: var(--font-body);
    color: var(--text-title);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
    width: 100%;
}

.field input::placeholder,
.textarea-custom::placeholder {
    color: var(--ink-faint);
}

.field input:focus,
.field select:focus,
.textarea-custom:focus {
    background-color: var(--bg-elevated);
    border-color: var(--sky);
    box-shadow: 0 0 0 4px var(--sky-soft);
}

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

/* Gestione Password */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap input {
    padding-right: 76px;
    width: 100%;
}

.toggle-pw {
    position: absolute;
    right: 12px;
    background: transparent;
    border: none;
    color: var(--ink-muted);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-xs);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.toggle-pw:hover {
    color: var(--sky-deep);
    background-color: var(--sky-soft);
}

/* --- 4. BIG FRIENDLY BUTTONS (Skylearn Button Kit) --- */
.btn {
    font-family: var(--font-display);
    background-color: var(--sky);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px 28px;
    min-height: 52px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    transition: all 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
    text-decoration: none;
}

.btn:hover {
    background-color: var(--sky-deep);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.btn:active {
    transform: scale(0.97);
    transition-duration: 120ms;
}

.btn:disabled {
    background-color: var(--ink-faint);
    color: #FFFFFF;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-block {
    display: flex;
    width: 100%;
    margin-top: 8px;
}

.btn-ghost {
    font-family: var(--font-display);
    background-color: var(--bg-elevated);
    border: 1px solid var(--border-color);
    color: var(--ink-muted);
    padding: 10px 20px;
    min-height: 46px;
    font-size: 15px;
    font-weight: 700;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}

.btn-ghost:hover {
    background-color: var(--sky-soft);
    color: var(--sky-deep);
    border-color: var(--sky-bright);
}

.btn-ghost:active {
    transform: scale(0.97);
}

.btn-danger {
    font-family: var(--font-display);
    background-color: var(--coral-soft);
    color: var(--coral-deep);
    border: 1px solid rgba(248, 113, 113, 0.35);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 240ms cubic-bezier(0.34, 1.56, 0.64, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-danger:hover {
    background-color: var(--coral);
    color: #FFFFFF;
    border-color: var(--coral);
    box-shadow: 0 4px 14px rgba(248, 113, 113, 0.25);
}

.link-btn {
    font-family: var(--font-display);
    color: var(--sky);
    text-decoration: none;
    font-weight: 700;
    background: none;
    border: none;
    cursor: pointer;
    font-size: inherit;
    transition: color 0.2s;
}

.link-btn:hover {
    color: var(--sky-deep);
    text-decoration: underline;
}

/* --- 5. NOTIFICHE ED ERRORI (Skylearn Gentle Feedback) --- */
.notice {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    line-height: 1.4;
}

.notice.error {
    background-color: var(--coral-soft);
    border: 1px solid var(--error-border);
    color: var(--error-text);
}

.notice.ok {
    background-color: var(--leaf-soft);
    border: 1px solid var(--success-border);
    color: var(--success-text);
}

.notice[hidden] {
    display: none;
}

/* --- 6. MODALI (Skylearn Soft Elevation & Wash) --- */
dialog {
    background-color: var(--bg-elevated);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 520px;
    box-shadow: var(--shadow-modal);
    margin: auto;
}

dialog::backdrop {
    background-color: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

dialog h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-title);
    margin-bottom: 16px;
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* --- 7. CARDS (Skylearn Soft Elevation) --- */
.card {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 240ms ease, border-color 240ms ease, transform 240ms ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

/* Badge Pills */
.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 700;
    font-family: var(--font-display);
    white-space: nowrap;
}

.tag-pill.sky {
    background-color: var(--sky-soft);
    color: var(--sky-deep);
}

.tag-pill.sun {
    background-color: var(--sun-soft);
    color: var(--sun-deep);
}

.tag-pill.leaf {
    background-color: var(--leaf-soft);
    color: var(--leaf-deep);
}

.tag-pill.coral {
    background-color: var(--coral-soft);
    color: var(--coral-deep);
}

/* ==========================================================================
   SISTEMA A GRIGLIA RESPONSIVA (12 Colonne)
   ========================================================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -10px;
    margin-right: -10px;
}

.col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    box-sizing: border-box;
    padding-left: 10px;
    padding-right: 10px;
}

.col-1  { width: 8.333333%; }
.col-2  { width: 16.666667%; }
.col-3  { width: 25%; }
.col-4  { width: 33.333333%; }
.col-5  { width: 41.666667%; }
.col-6  { width: 50%; }
.col-7  { width: 58.333333%; }
.col-8  { width: 66.666667%; }
.col-9  { width: 75%; }
.col-10 { width: 83.333333%; }
.col-11 { width: 91.666667%; }
.col-12 { width: 100%; }

@media (max-width: 992px) {
    .col-md-1  { width: 8.333333%; }
    .col-md-2  { width: 16.666667%; }
    .col-md-3  { width: 25%; }
    .col-md-4  { width: 33.333333%; }
    .col-md-5  { width: 41.666667%; }
    .col-md-6  { width: 50%; }
    .col-md-7  { width: 58.333333%; }
    .col-md-8  { width: 66.666667%; }
    .col-md-9  { width: 75%; }
    .col-md-10 { width: 83.333333%; }
    .col-md-11 { width: 91.666667%; }
    .col-md-12 { width: 100%; }
}

@media (max-width: 768px) {
    .col-sm-1  { width: 8.333333%; }
    .col-sm-2  { width: 16.666667%; }
    .col-sm-3  { width: 25%; }
    .col-sm-4  { width: 33.333333%; }
    .col-sm-5  { width: 41.666667%; }
    .col-sm-6  { width: 50%; }
    .col-sm-7  { width: 58.333333%; }
    .col-sm-8  { width: 66.666667%; }
    .col-sm-9  { width: 75%; }
    .col-sm-10 { width: 83.333333%; }
    .col-sm-11 { width: 91.666667%; }
    .col-sm-12 { width: 100%; }
    
    .row2 {
        grid-template-columns: 1fr;
    }
}