/* IMPORTIAMO IL FONT MODERNO E QUELLO A MANO */
@import url('https://fonts.googleapis.com/css2?family=Indie+Flower&family=Montserrat:wght@500;700;800&display=swap');

:root {
    /* TEMA LAVAGNA MODERNA (PERMANENTE) */
    --paper: #0f172a; 
    --paper-card: #1e293b; 
    --ink: #f8fafc; 
    --accent: #d35400; /* Accento arancione mantenuto */
    --grid: rgba(255,255,255,0.02);
    --border-subtle: rgba(255, 255, 255, 0.1); 
    --shadow-subtle: rgba(0, 0, 0, 0.3); 
    --glow: 0 0 8px rgba(255,255,255,0.1);
    
    --ui-font: 'Montserrat', sans-serif;
    --hand-font: 'Montserrat', sans-serif; 
}

.contenuto-sopra p {
    opacity: 1 !important;
}

::placeholder { color: var(--ink); opacity: 0.5; font-family: var(--hand-font); }

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

html, body {
    margin: 0; padding: 0; width: 100%; height: 100%;
    font-family: var(--ui-font); 
    background-color: var(--paper); 
    color: var(--ink);
    overflow-x: hidden; 
}

h1, h2, h3, label, .testo-btn, .bottone-penna, .label-tabella, .badge-modalita, .badge-reputazione {
    font-family: var(--ui-font);
}

.stile-penna, .textarea-regola, .input-regola-titolo, #header-nome-lega, #val-modalita, #val-partecipanti, #val-crediti, #val-visibilita, #val-extra, p, span, .valore-tabella { 
    font-family: var(--hand-font); 
}

.info-tooltip div, #sottotitolo-form, .info-icon { font-family: var(--ui-font); }
.info-tooltip span { font-family: var(--ui-font); font-size: 14px;}

p { font-size: 18px; } 

.foglio {
    min-height: 100vh; box-sizing: border-box; padding: 80px 40px 40px 50px; 
    background-color: var(--paper);
    border-color: #0b1121; 
    box-shadow: inset 0 0 100px rgba(0,0,0,0.5);
    background-image: 
        radial-gradient(circle, var(--grid) 1px, transparent 1px),
        radial-gradient(circle, var(--grid) 1px, transparent 1px);
    background-size: 24px 24px, 16px 16px; 
    background-position: 0 0, 12px 12px;
    position: relative; transition: all 0.5s;
    border: 10px solid #0b1121; 
}

.filigrana {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    opacity: 0.03; color: var(--ink); pointer-events: none; z-index: 0;
    display: flex; justify-content: center; align-items: center; overflow: hidden;
}
.filigrana svg { width: 100%; height: 100%; object-fit: cover; }

.contenuto-sopra { position: relative; z-index: 1; text-align: center; text-shadow: var(--glow); }

.stile-penna {
    font-size: 20px; background: transparent; 
    border: none; border-bottom: 2px solid var(--border-subtle); color: var(--ink); width: 280px; outline: none;
    transition: border-color 0.3s;
    box-sizing: border-box;
}
.stile-penna:focus { border-bottom-color: var(--accent); }

select.stile-penna { cursor: pointer; }
select.stile-penna option { color: #000; background: #fff; font-family: var(--ui-font); }

.bottone-penna {
    font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px;
    background-color: var(--paper-card); color: var(--ink); 
    border: 2px solid var(--border-subtle); border-radius: 10px; padding: 10px 20px;
    cursor: pointer; margin: 5px; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-shadow: none;
}

.bottone-penna:hover { 
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    border-color: var(--ink);
}

.bottone-penna:active { transform: translateY(1px); box-shadow: 0 2px 5px rgba(0,0,0,0.05); }

.icona-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background-color: transparent;
    border: none; 
    margin-right: 12px;
    color: currentColor; 
}

.icona-mobile { display: none; }
.testo-desktop { display: inline; }

.btn-salva { color: #10b981; }
.btn-salva:hover { background-color: #10b981; color: #fff; border-color: #10b981; }
.btn-elimina { color: var(--accent); }
.btn-elimina:hover { background-color: var(--accent); color: #fff; border-color: var(--accent); }
.btn-condividi { color: var(--ink); }

@keyframes brillantezza-night {
    0% { box-shadow: 0 4px 10px rgba(0,0,0,0.2), 0 0 5px rgba(56, 189, 248, 0.3); }
    50% { box-shadow: 0 4px 10px rgba(0,0,0,0.2), 0 0 15px rgba(56, 189, 248, 0.7); }
    100% { box-shadow: 0 4px 10px rgba(0,0,0,0.2), 0 0 5px rgba(56, 189, 248, 0.3); }
}

.btn-ai-glow {
    color: #38bdf8; border-color: #38bdf8;
    animation: brillantezza-night 2s infinite ease-in-out; display: inline-flex; align-items: center;
}
.btn-ai-glow:hover { animation: none; } 

.barra-strumenti {
    position: absolute; top: 20px; right: 30px; left: 30px; z-index: 100;
    display: flex; justify-content: space-between; align-items: center;
}
.gruppo-destra { display: flex; gap: 12px; align-items: center; margin-left: auto; }

.bottone-segnalibro {
    font-size: 14px; font-weight: 700; background-color: var(--paper-card); color: var(--ink); 
    border: 2px solid var(--border-subtle); border-radius: 10px; padding: 8px 16px;
    cursor: pointer; transition: all 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    display: flex; align-items: center; gap: 6px; height: 44px; text-shadow: none;
}
.bottone-segnalibro:hover { transform: translateY(-2px); border-color: var(--ink); box-shadow: 0 8px 20px rgba(0,0,0,0.4); }

.btn-bacheca-speciale { border-color: var(--accent); color: var(--accent); background: transparent; }
.link-switch { color: var(--accent); cursor: pointer; font-weight: bold; text-decoration: underline; font-family: var(--ui-font); }

/* HAMBURGER MENU - NASCOSTO SU DESKTOP */
.hamburger-btn { 
    display: none; 
    background: transparent; border: none; box-shadow: none; 
    padding: 5px; cursor: pointer; outline: none; margin: 0;
}
.drawer-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.6); z-index: 9998;
    display: none; opacity: 0; transition: opacity 0.3s;
}
.drawer-overlay.open { display: block; opacity: 1; }

.mobile-drawer {
    position: fixed; top: 0; left: -280px; width: 260px; height: 100vh;
    background: var(--paper-card); z-index: 9999;
    box-shadow: 5px 0 15px var(--shadow-subtle);
    transition: left 0.3s ease; display: flex; flex-direction: column;
    padding-top: 20px; overflow-y: auto; color: var(--ink);
}
.mobile-drawer.open { left: 0; }

.btn-drawer {
    background: transparent; border: none; box-shadow: none; 
    border-bottom: 1px solid var(--border-subtle); border-radius: 0; 
    text-align: left; padding: 18px 20px; font-size: 16px; margin: 0; 
    color: var(--ink); font-family: var(--ui-font); font-weight: 700;
    text-transform: uppercase; cursor: pointer;
    display: flex; align-items: center;
}
.btn-drawer:hover { background: rgba(255,255,255,0.05); transform: none; box-shadow: none;}

/* SIDEBAR DESKTOP - ALLINEATA E SIMMETRICA AL TASTO HOME */
.sidebar-desktop {
    position: absolute;
    left: -20px; 
    top: 0; 
    width: 240px; 
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
}

.btn-nav-side {
    width: 100%;
    margin: 0;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box; 
}

.sottomenu-albo {
    background: var(--paper-card);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 10px 25px var(--shadow-subtle);
    max-height: 400px;
    overflow-y: auto;
    text-align: left;
    box-sizing: border-box; 
}

.riquadro-regola, .annuncio { 
    background: var(--paper-card);
    border: 1px solid var(--border-subtle); 
    margin-bottom: 25px; 
    border-radius: 16px; 
    overflow: visible; 
    text-align: left; 
    box-shadow: 0px 10px 30px var(--shadow-subtle); 
    width: 100%; 
    box-sizing: border-box; 
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease;
}

.riquadro-regola:hover, .annuncio:hover {
    transform: translateY(-4px);
    box-shadow: 0px 15px 35px rgba(0,0,0,0.4);
}

.intestazione-regola { 
    display: flex; justify-content: space-between; align-items: center; 
    padding: 20px 25px; cursor: pointer; 
    border-bottom: 1px solid transparent; 
    color: var(--ink); flex-wrap: wrap; gap: 10px; 
}
.corpo-regola { padding: 25px; display: none; border-top: 1px solid var(--border-subtle); } 
.corpo-regola.aperto { display: block; }

.input-regola-titolo { font-size: 24px; background: transparent; border: none; border-bottom: 2px solid var(--border-subtle); color: var(--ink); outline: none; width: 100%; max-width: 350px; text-shadow: var(--glow); transition: border-color 0.3s; box-sizing: border-box;}
.input-regola-titolo:focus { border-bottom-color: var(--accent); }
.textarea-regola { font-size: 20px; background: transparent; border: none; color: var(--ink); outline: none; width: 100%; min-height: 100px; resize: vertical; margin-bottom: 20px; text-shadow: var(--glow); line-height: 1.4; box-sizing: border-box;}
.bottoni-regola { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }

.freccia-espandi {
    font-size: 24px; font-weight: bold; display: inline-block;
    transition: transform 0.3s ease; transform: rotate(90deg); 
    margin-left: 5px; color: var(--ink); font-family: var(--ui-font); opacity: 0.5;
}
.freccia-espandi.aperta { transform: rotate(-90deg); opacity: 1; }

.annuncio { 
    padding: 25px; 
    display: flex; justify-content: space-between; align-items: flex-start; 
    max-width: 600px; margin: 0 auto 25px auto; 
}

.badge-modalita { background-color: var(--ink); color: var(--paper-card); font-size: 11px; padding: 4px 10px; border-radius: 12px; text-shadow: none; font-weight: 800; letter-spacing: 0.5px; }
.badge-reputazione { background-color: transparent; border: 2px solid #e1b12c; color: #e1b12c; padding: 4px 10px; border-radius: 8px; font-weight: bold; text-shadow: none; }
.stelle-bacheca { color: #e1b12c; letter-spacing: 2px; font-size: 18px; }

.badge-oro { background: rgba(253, 230, 138, 0.15); color: #fcd34d; padding: 4px 8px; border-radius: 8px; display: inline-block;}
.badge-argento { background: rgba(229, 231, 235, 0.15); color: #e5e7eb; padding: 4px 8px; border-radius: 8px; display: inline-block;}
.badge-bronzo { background: rgba(253, 186, 116, 0.15); color: #fdba74; padding: 4px 8px; border-radius: 8px; display: inline-block;}

.cartoncino { 
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    background: var(--paper-card); border: 1px solid var(--border-subtle); color: var(--ink); text-shadow: var(--glow);
    padding: 30px; box-shadow: 0px 20px 60px var(--shadow-subtle); z-index: 200; border-radius: 16px; width: 90%; max-width: 400px; 
    max-height: 90vh; overflow-y: auto;
    box-sizing: border-box; 
}

.info-tooltip-container { position: relative; display: inline-block; vertical-align: middle; margin: 0 5px; }

.info-icon { 
    width: 24px; height: 24px; background-color: transparent; color: var(--ink); 
    border: none; display: inline-flex; align-items: center; justify-content: center; 
    cursor: pointer; transition: all 0.2s; opacity: 0.6;
}
.info-icon:hover { transform: translateY(-2px); color: var(--accent); opacity: 1; }

.info-tooltip { 
    visibility: hidden; width: 280px; background-color: var(--paper-card); color: var(--ink); 
    border: 1px solid var(--border-subtle); border-radius: 12px; padding: 20px; position: absolute; 
    z-index: 9999; 
    top: 100%; left: 50%; transform: translateX(-50%); margin-top: 10px;
    opacity: 0; transition: opacity 0.2s, top 0.2s; font-size: 15px; text-align: left; 
    box-shadow: 0 15px 40px var(--shadow-subtle); text-shadow: none; 
    box-sizing: border-box;
}

.info-tooltip::after { 
    content: ""; position: absolute; bottom: 100%; left: 50%; margin-left: -8px; 
    border-width: 8px; border-style: solid; border-color: transparent transparent var(--paper-card) transparent; 
}
.info-tooltip-container:hover .info-tooltip { visibility: visible; opacity: 1; top: 120%; } 

.bottoni-dashboard { display: flex; justify-content: center; gap: 15px; max-width: 550px; margin: 0 auto; }
.bottoni-dashboard button { flex: 1; font-size: 15px; padding: 15px 10px; margin: 0; }

.titolo-sezione { 
    font-family: var(--ui-font); font-weight: 800; color: var(--ink); font-size: 24px;
    margin-top: 50px; margin-bottom: 20px; border-bottom: 2px solid var(--border-subtle); 
    padding-bottom: 10px; text-align: left; width: 100%; max-width: 850px; margin-left: auto; margin-right: auto;
}

.desktop-only { display: inline-block; }

/* ---- NUOVI STILI CENTRO NOTIFICHE ---- */
.notifica-item {
    padding: 15px; border-bottom: 1px solid var(--border-subtle); text-align: left; cursor: pointer; transition: background 0.2s; border-radius: 8px; margin-bottom: 5px;
}
.notifica-item.non-letta {
    background: rgba(211, 84, 0, 0.1); border-left: 4px solid var(--accent); border-radius: 0 8px 8px 0;
}
.notifica-item:hover { background: rgba(255,255,255,0.05); }
.notifica-testo { font-family: var(--ui-font); font-size: 14px; color: var(--ink); }
.notifica-data { font-family: var(--ui-font); font-size: 11px; opacity: 0.5; margin-top: 5px; }

/* ---- STILI BARRA INFERIORE MOBILE ---- */
.bottom-bar {
    display: none; 
    position: fixed; bottom: 0; left: 0; width: 100%; height: 60px;
    background: var(--paper-card); border-top: 1px solid var(--border-subtle);
    z-index: 9999; justify-content: space-around; align-items: center;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
}
.bottom-bar-btn {
    background: transparent; border: none; color: var(--ink); display: flex; flex-direction: column;
    align-items: center; justify-content: center; width: 100%; height: 100%; cursor: pointer; opacity: 0.7; transition: opacity 0.2s; position: relative;
}
.bottom-bar-btn:active { opacity: 1; color: var(--accent); }
.pallino-mobile {
    position: absolute; top: 12px; right: calc(50% - 15px); width: 8px; height: 8px; background-color: #ef4444; border-radius: 50%; display: none;
}

@media (max-width: 1250px) {
    .sidebar-desktop { width: 180px; }
    .btn-nav-side { font-size: 11px; }
}

/* MEDIA QUERY PER SMARTPHONE */
@media (max-width: 950px) { 
    .desktop-only { display: none !important; }
    .sidebar-desktop { display: none !important; } 
    .gruppo-destra { display: none !important; } 
    .hamburger-btn { display: block; } 

    .foglio { border-width: 0px; padding: 20px 15px 90px 15px; } 
    
    .mostra-bottom-bar { display: flex !important; }
    #btn-home, #wrap-campanella { display: none !important; }
    
    .intestazione-regola { font-size: 18px; padding: 15px; } 
    
    .barra-strumenti { 
        position: relative; top: 0; left: 0; right: 0; 
        width: 100%; justify-content: space-between; 
        margin-bottom: 30px; padding: 0;
    }
    .testo-btn { display: none; }
    
    .header-lettura { justify-content: center; text-align: center; gap: 20px; margin-bottom: 20px; margin-left: 0 !important; }
    .header-lettura > div { text-align: center !important; flex: none !important; width: 100%; }
    h1#header-nome-lega { font-size: 45px !important; } 
    
    .bottoni-dashboard button { font-size: 14px; padding: 12px 5px; }

    .bottoni-regola { gap: 8px !important; justify-content: flex-end; }
    .icona-mobile { display: block; margin: 0; width: 20px; height: 20px; } 
    .testo-desktop { display: none; }
    
    .bottone-penna:hover { transform: none; box-shadow: 0 4px 10px rgba(0,0,0,0.2); border-color: var(--border-subtle); }
    
    .bottone-penna:active { transform: translate(1px, 1px); box-shadow: inset 0 2px 4px rgba(0,0,0,0.1); }

    .btn-ai-glow:hover { animation: brillantezza-night 2s infinite ease-in-out; }
    
    .btn-azione-regola {
        background-color: var(--paper-card) !important;
        padding: 10px !important;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50% !important; 
        width: 44px; height: 44px;
    }
    
    .btn-salva { border-color: var(--border-subtle) !important; color: #10b981 !important; }
    .btn-salva:active { background-color: #10b981 !important; color: #fff !important; }
    
    .btn-elimina { border-color: var(--border-subtle) !important; color: var(--accent) !important; }
    .btn-elimina:active { background-color: var(--accent) !important; color: #fff !important; }
    
    .btn-condividi { border-color: var(--border-subtle) !important; color: var(--ink) !important; }
    .btn-condividi:active { background-color: var(--ink) !important; color: var(--paper-card) !important; }

    .btn-ai-glow { border-color: var(--border-subtle) !important; }
}