/* ============================================================
   1. VARIABILI E RESET
   ============================================================ */
:root {
    --gold: #a4884a;
    --gold-bright: #ffd700;
    --dark-bg: #161613;
    --bronze: #8b7350;
    --bronze-light: #c2b49c;
    --paper-light: #f2e3c9;
    --red-seal: #800000;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    background: #f0f0f0;
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: #333;
    font-family: 'EB Garamond', 'Palatino Linotype', serif;
}

/* ============================================================
   2. GRID LAYOUT GENERALE
   ============================================================ */
.container {
    height: 95%;
    display: grid;
    grid-template-columns: 200px 1fr 250px;
    grid-template-rows: auto 1fr auto;
    gap: 10px;
    padding: 10px;
}

.topmenu { grid-column: 1 / 4; }
.left    { grid-column: 1; }
.center  { grid-column: 2; }
.right   { grid-column: 3; }
.footer  { grid-column: 1 / 4; text-align: center; }

.box {
    background: white;
    padding: 15px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.content {
    padding: 20px;
    max-width: 900px;
    margin: auto;
    background: #fff;
    min-height: 500px;
    border-radius: 8px;
    box-shadow: 0 0 10px #ccc;
}

/* ============================================================
   3. MENU TOP - FILAMENTO DI LUCE SOTTILE ED EPICO
   ============================================================ */
.menu {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 50px;
    position: relative;
    z-index: 1001;
    border-bottom: 2px solid;
    border-image: linear-gradient(to right, transparent, var(--gold), transparent) 1;
}

.menu a {
    all: unset !important;
    box-sizing: border-box !important;
    display: inline-flex !important; 
    align-items: center !important;
    justify-content: center !important;
    color: var(--bronze-light) !important;
    font-family: 'Cinzel', serif !important;
    font-size: 13px !important;
    font-weight: bold !important;
    text-transform: uppercase !important;
    letter-spacing: 1.5px !important;
    cursor: pointer !important;
    padding: 0 18px !important; 
    height: 50px !important;
    position: relative !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    text-shadow: 1px 1px 3px rgba(0,0,0,1);
}

/* --- HOVER: ZOOM E BAGLIORE TESTO --- */
.menu a:hover {
    color: #fff !important;
    transform: translateY(-2px) scale(1.05) !important;
    text-shadow: 0 0 12px var(--gold-bright), 0 0 20px #ff8c00 !important;
}

/* --- LA BARRA DI LUCE (FILAMENTO SOTTILE) --- */
.menu a::after {
    content: "";
    position: absolute;
    /* Posizionata esattamente sopra il bordo inferiore */
    bottom: -1px; 
    left: 50%;
    width: 0;
    /* Molto sottile fisicamente, ma espansa dal bagliore */
    height: 1px; 
    /* Gradiente che sfuma ai lati per non essere "tozza" */
    background: radial-gradient(circle, #fff 0%, var(--gold-bright) 70%, transparent 100%);
    /* Bagliore ultra-luminoso che crea l'effetto "alone" di 10-15px */
    box-shadow: 
        0 0 10px 2px var(--gold-bright), 
        0 0 20px 4px rgba(255, 215, 0, 0.5);
    transition: width 0.4s cubic-bezier(0.23, 1, 0.32, 1), left 0.4s cubic-bezier(0.23, 1, 0.32, 1) !important;
    z-index: 10;
}

.menu a:hover::after {
    /* Larghezza ridotta al 70-80% per non toccare i vicini e sembrare più elegante */
    width: 80%; 
    left: 10%;
}

/* --- EFFETTO EXTRA SULLE SPADE --- */
.menu a span {
    display: inline-flex;
    align-items: center;
    margin: 0 5px;
    filter: drop-shadow(0 0 2px rgba(0,0,0,0.5));
    transition: transform 0.3s ease;
}

.menu a:hover span {
    transform: scale(1.2) rotate(5deg);
}

/* --- NOTIFICHE E BADGE --- */
.link-unread {
    color: #ffda44 !important;
    animation: criticalLight 1.5s infinite alternate;
}

@keyframes criticalLight {
    from { filter: drop-shadow(0 0 2px var(--gold-bright)); }
    to { filter: drop-shadow(0 0 12px var(--gold-bright)); }
}

.unread-badge {
    background: radial-gradient(circle at 30% 30%, #ff4d4d, #800000) !important;
    color: #fff !important;
    padding: 0 6px !important;
    border-radius: 10px !important;
    font-size: 10px !important;
    height: 16px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    margin-left: 5px !important;
    border: 1px solid #ff0000 !important;
    box-shadow: 0 0 8px rgba(255, 0, 0, 0.6) !important;
    text-shadow: none !important;
    transform: scale(0.85);
}
/* Sub menu */
/* Contenitore per azzerare spazi indesiderati */
.vortex-navigation {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 20px;
}

/* Stile per il secondo menu */
.menu-secondary {
    display: flex;
    justify-content: center;
    gap: 5%;
    padding: 6px;
}

.menu-secondary a {
    font-family: 'EB Garamond', serif;
    font-size: 13px;
    color: #b0b0b0; /* Grigio ghiaccio/tenue */
    text-transform: uppercase;
    letter-spacing: 1px;
    text-decoration: none;
    transition: 0.3s;
}

.menu-secondary a:hover {
    color: #f1e5ac; /* Oro chiaro al passaggio */
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

/* Responsive: se lo schermo è piccolo si incolonnano bene */
@media (max-width: 768px) {
    .menu, .menu-secondary {
        flex-wrap: wrap;
        gap: 8px;
    }
}


/* ============================================================
   4. PANNELLO OFF-CHAT (SIDEBAR)
   ============================================================ */
.offchat-sidebar {
    position: fixed;
    top: 0;
    right: -350px;
    width: 320px;
    height: 100vh;
    background: linear-gradient(145deg, #f8f2e4, #efe6d0);
    border-left: 3px solid var(--bronze);
    box-shadow: -10px 0 30px rgba(0,0,0,0.8);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.offchat-sidebar.active { right: 0; }

.offchat-header {
    background: #161613;
    color: var(--gold);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--gold);
    font-family: 'Cinzel', serif;
}

.offchat-body {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    background-image: url('https://www.transparenttextures.com/patterns/paper.png');
}

.off-msg {
    border-bottom: 1px solid rgba(139, 115, 80, 0.2);
    padding: 8px 0;
    color: #3b2b1a;
}

.offchat-footer {
    padding: 15px;
    background: #e2d5b5;
    border-top: 2px solid var(--bronze);
}

.offchat-form { display: flex; gap: 8px; }

.offchat-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--bronze);
    background: rgba(255,255,255,0.8);
    font-family: 'EB Garamond', serif;
}

.offchat-form button {
    background: linear-gradient(to bottom, #4b3e2f, #2a2218);
    color: #d4c5a1;
    border: 1px solid var(--gold);
    font-family: 'Cinzel', serif;
    padding: 5px 15px;
    cursor: pointer;
}

/* ============================================================
   5. UI COMPONENTS (MESSAGGI, CHAT, TICKER)
   ============================================================ */

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #1e1e1e; }
::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 6px;
    border: 2px solid #1e1e1e;
}
::-webkit-scrollbar-thumb:hover { background: #888; }

/* Alerts / Messaggi */
.msg-success, .msg-error {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-left: 5px solid;
    animation: fadeIn 0.4s ease-out;
}

.msg-success { background-color: #ecfdf5; color: #065f46; border-color: #10b981; }
.msg-success::before { content: '✅'; font-size: 1.2em; }

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

/* News Ticker */
.news-ticker {
    width: 100%;
    background: #1a1c1e;
    border-bottom: 1px solid var(--bronze);
    overflow: hidden;
    white-space: nowrap;
    height: 25px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 100;
}

.news-banner-content {
    display: inline-block;
    padding-left: 100%;
    animation: ticker-move 60s linear infinite;
}

.news-banner-content span {
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    color: var(--bronze-light);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: bold;
    text-shadow: 1px 1px 2px #000;
}

@keyframes ticker-move {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* ============================================================
   6. RESET E STILE DEDICATO PER I LINK NELLA OFF-CHAT
   ============================================================ */

/* Forza il testo normale nella sidebar */
.offchat-sidebar, 
.offchat-body, 
.off-msg {
    font-family: 'EB Garamond', serif !important;
    font-size: 15px !important;
    line-height: 1.4 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    color: #3b2b1a !important; /* Il marrone scuro che hai già scelto */
}

/* Reset totale per i link dentro la offchat-body */
.offchat-body a {
    all: unset !important; /* Azzera tutti gli stili ereditati (bagliori, zoom, spade) */
    box-sizing: border-box !important;
    display: inline !important; /* Li riporta a comportamento testo */
    
    /* Nuovo stile pulito e variabile */
    color: var(--red-seal) !important; /* Colore distintivo ma sobrio */
    text-decoration: underline !important;
    cursor: pointer !important;
    transition: color 0.2s ease !important;
}

/* Hover pulito (senza bagliori epici del menu) */
.offchat-body a:hover {
    color: #b00000 !important;
    background: rgba(139, 115, 80, 0.1) !important; /* Leggerissima evidenza */
    text-shadow: none !important;
    transform: none !important;
}

/* Rimuove eventuali pseudo-elementi (come le barre di luce del menu) */
.offchat-body a::after, 
.offchat-body a::before {
    content: none !important;
    display: none !important;
}

.offchat-body p {
    /* Reset dei margini per evitare scroll strani */
    margin: 0 0 12px 0 !important;
    padding: 0 !important;
    
    /* Reset tipografico totale */
    all: unset !important;
    display: block !important; /* Il p deve restare un elemento a tutta larghezza */
    
    /* Stile specifico per la lettura GDR */
    font-family: 'EB Garamond', serif !important;
    font-size: 16px !important;
    line-height: 1.5 !important;
    color: #3b2b1a !important;
    text-align: left !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-wrap: break-word !important;
}

/* Rimuove eventuali icone o decorazioni automatiche iniettate da altri CSS */
.offchat-body p::before,
.offchat-body p::after {
    content: none !important;
}

    .dashboard-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        margin-top: 20px;
    }
    .dash-box {
        background: rgba(26, 29, 33, 0.7);
        border: 1px solid rgba(212, 175, 55, 0.2);
        border-top: 2px solid var(--gold);
        border-radius: 4px;
        padding: 15px;
    }
    .dash-box h3 {
        font-family: 'Cinzel', serif;
        color: var(--gold-light);
        font-size: 14px;
        margin-bottom: 12px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding-bottom: 5px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .stats-number {
        font-family: 'Cinzel', serif;
        font-size: 28px;
        font-weight: bold;
        color: #fff;
        display: block;
        line-height: 1;
    }
    .stat-detail {
        font-size: 11px;
        color: #aaa;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .dash-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    .dash-item {
        padding: 10px;
        border-bottom: 1px solid rgba(255,255,255,0.03);
        background: rgba(255,255,255,0.01);
        margin-bottom: 8px;
        border-radius: 4px;
    }
    .dash-item:hover {
        background: rgba(255,255,255,0.04);
    }

    .dash-item a {
        color: var(--ice-soft);
        text-decoration: none;
        font-weight: bold;
        font-size: 14px;
        display: inline-block;
        margin-bottom: 3px;
    }
    .dash-item a:hover {
        color: #fff;
        text-shadow: 0 0 5px var(--ice-soft);
    }

    .tag-world {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 3px;
        font-size: 9px;
        font-weight: bold;
        color: black !important;
        font-family: arial;
        text-transform: uppercase;
        margin: 4px 0;
    }

    .scroll-box {
        max-height: 400px;
        overflow-y: auto;
        padding-right: 5px;
        scrollbar-width: thin;
        scrollbar-color: var(--gold) transparent;
    }
    .scroll-box::-webkit-scrollbar {
        width: 4px;
    }
    .scroll-box::-webkit-scrollbar-thumb {
        background: var(--gold);
    }

    .event-desc {
        font-size: 12px;
        color: #bbb;
        margin-top: 8px;
        line-height: 1.5;
        font-style: italic;
        border-left: 2px solid rgba(212, 175, 55, 0.3);
        padding-left: 10px;
    }
    .vortex-info-row {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        font-size: 13px;
        border-bottom: 1px solid rgba(255,255,255,0.03);
    }
    .vortex-info-row span:first-child {
        color: #888;
        text-transform: uppercase;
        font-size: 10px;
        font-weight: bold;
    }
    .vortex-info-row span:last-child {
        color: var(--ice-soft);
    }
    .presence-btn.active {
        background: var(--gold) !important;
        color: #000 !important;
    }
    .presence-btn:hover {
        background: rgba(212, 175, 55, 0.2);
    }
    .tag-category {
        display: inline-block;
        padding: 2px 6px;
        border-radius: 3px;
        font-size: 10px;
        font-weight: bold;
        color: #fff;
        margin-left: 5px;
        text-transform: uppercase;
    }
    .cat-Quest {
        background: #2980b9;
    }
    .cat-Manutenzione {
        background: #c0392b;
    }
    .cat-Altro {
        background: #7f8c8d;
    }

    /* NUOVO: Stile della lista partecipanti ed elementi del Pop-Up */
    .event-participants-list {
        margin-top: 10px;
        padding: 6px 10px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
        font-size: 11px;
        color: #ddd;
        border: 1px solid rgba(255, 255, 255, 0.03);
    }

    .vortex-modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.85);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    .vortex-modal-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
    .vortex-modal {
        background: #1a1d21;
        border: 1px solid var(--gold);
        border-radius: 6px;
        padding: 20px;
        width: 320px;
        text-align: center;
        box-shadow: 0 0 15px rgba(0,0,0,0.5);
    }
    .vortex-modal h4 {
        font-family: 'Cinzel', serif;
        color: var(--gold-light);
        margin: 0 0 15px 0;
        font-size: 15px;
    }
    .vortex-modal-btn {
        display: block;
        width: 100%;
        padding: 10px;
        margin-bottom: 8px;
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(212,175,55,0.3);
        color: #fff;
        text-align: left;
        cursor: pointer;
        border-radius: 4px;
        font-weight: bold;
    }
    .vortex-modal-btn:hover {
        background: rgba(212,175,55,0.15);
        border-color: var(--gold);
    }
    .vortex-modal-close {
        background: none;
        border: none;
        color: #888;
        font-size: 11px;
        text-transform: uppercase;
        cursor: pointer;
        margin-top: 5px;
        text-decoration: underline;
    }
    /* Stili per il Modal Dialog */
    .cal-modal {
        width: 90%;
        max-width: 1100px;
        height: 80vh;
        background: #12161a;
        border: 1px solid var(--gold);
        border-radius: 8px;
        padding: 0;
        color: #fff;
        box-shadow: 0 0 25px rgba(0,0,0,0.7);
        overflow: hidden;
    }

    /* Sfondo oscurato nativo */
    .cal-modal::backdrop {
        background: rgba(0, 0, 0, 0.75);
        backdrop-filter: blur(3px);
    }

    .cal-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        background: #1a2127;
        border-bottom: 1px solid #2d3741;
    }

    .cal-modal-header h2 {
        margin: 0;
        font-size: 18px;
        color: var(--gold-light);
    }

    .cal-close-btn {
        background: none;
        border: none;
        color: #fff;
        font-size: 28px;
        cursor: pointer;
        line-height: 1;
    }
    .cal-close-btn:hover {
        color: var(--gold);
    }

    /* Layout Corpo a 2 Colonne */
    .cal-modal-body {
        display: grid;
        grid-template-columns: 300px 1fr;
        height: calc(80vh - 60px);
    }

    /* Sidebar Sinistra */
    .cal-sidebar {
        background: #161c22;
        border-right: 1px solid #2d3741;
        display: flex;
        flex-direction: column;
    }
    .cal-sidebar h3 {
        padding: 15px 15px 5px 15px;
        margin: 0;
        font-size: 14px;
        color: var(--ice-soft);
    }

    .cal-list-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 10px;
    }

    .cal-sidebar-item {
        background: #1d252d;
        border-left: 3px solid var(--gold);
        padding: 10px;
        margin-bottom: 8px;
        border-radius: 0 4px 4px 0;
        cursor: pointer;
        transition: background 0.2s;
    }
    .cal-sidebar-item:hover {
        background: #26313b;
    }

    /* Calendario Principale a Destra */
    .cal-main {
        padding: 20px;
        display: flex;
        flex-direction: column;
        background: #12161a;
    }

    .cal-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }
    .cal-nav button {
        background: #1a2127;
        border: 1px solid #444;
        color: #fff;
        padding: 5px 15px;
        cursor: pointer;
        border-radius: 4px;
    }
    .cal-nav button:hover {
        border-color: var(--gold);
        color: var(--gold);
    }

    .cal-grid-header {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        text-align: center;
        font-weight: bold;
        color: var(--gold-light);
        padding-bottom: 10px;
        border-bottom: 1px solid #2d3741;
    }

    .cal-grid-cells {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        grid-auto-rows: minmax(80px, 1fr);
        gap: 4px;
        margin-top: 5px;
        flex: 1;
    }

    /* Celle dei giorni */
    .cal-day-cell {
        background: #1a2127;
        border: 1px solid #232d37;
        padding: 5px;
        border-radius: 4px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .cal-day-cell.empty {
        background: #0f1316;
        border-color: transparent;
    }
    .cal-day-cell .day-num {
        font-size: 11px;
        color: #888;
        font-weight: bold;
        margin-bottom: 4px;
    }
    .cal-day-cell.today {
        border: 1px solid var(--gold);
        background: #1e242a;
    }
    .cal-day-cell.today .day-num {
        color: var(--gold);
    }

    /* Badge degli eventi dentro il calendario */
    .cal-event-badge {
        font-size: 9px;
        padding: 2px 4px;
        margin-bottom: 3px;
        border-radius: 3px;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: bold;
    }
    .dashboard-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
        margin-top: 20px;
    }
    .dash-box {
        background: rgba(26, 29, 33, 0.7);
        border: 1px solid rgba(212, 175, 55, 0.2);
        border-top: 2px solid var(--gold);
        border-radius: 4px;
        padding: 15px;
    }
    .dash-box h3 {
        font-family: 'Cinzel', serif;
        color: var(--gold-light);
        font-size: 14px;
        margin-bottom: 12px;
        border-bottom: 1px solid rgba(255,255,255,0.05);
        padding-bottom: 5px;
        text-transform: uppercase;
        letter-spacing: 1px;
    }

    .stats-number {
        font-family: 'Cinzel', serif;
        font-size: 28px;
        font-weight: bold;
        color: #fff;
        display: block;
        line-height: 1;
    }
    .stat-detail {
        font-size: 11px;
        color: #aaa;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .dash-list {
        list-style: none;
        padding: 0;
        margin: 0;
    }
    .dash-item {
        padding: 10px;
        border-bottom: 1px solid rgba(255,255,255,0.03);
        background: rgba(255,255,255,0.01);
        margin-bottom: 8px;
        border-radius: 4px;
    }
    .dash-item:hover {
        background: rgba(255,255,255,0.04);
    }

    .dash-item a {
        color: var(--ice-soft);
        text-decoration: none;
        font-weight: bold;
        font-size: 14px;
        display: inline-block;
        margin-bottom: 3px;
    }
    .dash-item a:hover {
        color: #fff;
        text-shadow: 0 0 5px var(--ice-soft);
    }

    .tag-world {
        display: inline-block;
        padding: 2px 8px;
        border-radius: 3px;
        font-size: 9px;
        font-weight: bold;
        color: black !important;
        font-family: arial;
        text-transform: uppercase;
        margin: 4px 0;
    }

    .scroll-box {
        max-height: 400px;
        overflow-y: auto;
        padding-right: 5px;
        scrollbar-width: thin;
        scrollbar-color: var(--gold) transparent;
    }
    .scroll-box::-webkit-scrollbar {
        width: 4px;
    }
    .scroll-box::-webkit-scrollbar-thumb {
        background: var(--gold);
    }

    .event-desc {
        font-size: 12px;
        color: #bbb;
        margin-top: 8px;
        line-height: 1.5;
        font-style: italic;
        border-left: 2px solid rgba(212, 175, 55, 0.3);
        padding-left: 10px;
    }
    .vortex-info-row {
        display: flex;
        justify-content: space-between;
        padding: 6px 0;
        font-size: 13px;
        border-bottom: 1px solid rgba(255,255,255,0.03);
    }
    .vortex-info-row span:first-child {
        color: #888;
        text-transform: uppercase;
        font-size: 10px;
        font-weight: bold;
    }
    .vortex-info-row span:last-child {
        color: var(--ice-soft);
    }
    .presence-btn.active {
        background: var(--gold) !important;
        color: #000 !important;
    }
    .presence-btn:hover {
        background: rgba(212, 175, 55, 0.2);
    }
    .tag-category {
        display: inline-block;
        padding: 2px 6px;
        border-radius: 3px;
        font-size: 10px;
        font-weight: bold;
        color: #fff;
        margin-left: 5px;
        text-transform: uppercase;
    }
    .cat-Quest {
        background: #2980b9;
    }
    .cat-Manutenzione {
        background: #c0392b;
    }
    .cat-Altro {
        background: #7f8c8d;
    }

    /* NUOVO: Stile della lista partecipanti ed elementi del Pop-Up */
    .event-participants-list {
        margin-top: 10px;
        padding: 6px 10px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 4px;
        font-size: 11px;
        color: #ddd;
        border: 1px solid rgba(255, 255, 255, 0.03);
    }

    .vortex-modal-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.85);
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 9999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }
    .vortex-modal-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }
    .vortex-modal {
        background: #1a1d21;
        border: 1px solid var(--gold);
        border-radius: 6px;
        padding: 20px;
        width: 320px;
        text-align: center;
        box-shadow: 0 0 15px rgba(0,0,0,0.5);
    }
    .vortex-modal h4 {
        font-family: 'Cinzel', serif;
        color: var(--gold-light);
        margin: 0 0 15px 0;
        font-size: 15px;
    }
    .vortex-modal-btn {
        display: block;
        width: 100%;
        padding: 10px;
        margin-bottom: 8px;
        background: rgba(255,255,255,0.03);
        border: 1px solid rgba(212,175,55,0.3);
        color: #fff;
        text-align: left;
        cursor: pointer;
        border-radius: 4px;
        font-weight: bold;
    }
    .vortex-modal-btn:hover {
        background: rgba(212,175,55,0.15);
        border-color: var(--gold);
    }
    .vortex-modal-close {
        background: none;
        border: none;
        color: #888;
        font-size: 11px;
        text-transform: uppercase;
        cursor: pointer;
        margin-top: 5px;
        text-decoration: underline;
    }
    /* Stili per il Modal Dialog */
    .cal-modal {
        width: 90%;
        max-width: 1100px;
        height: 80vh;
        background: #12161a;
        border: 1px solid var(--gold);
        border-radius: 8px;
        padding: 0;
        color: #fff;
        box-shadow: 0 0 25px rgba(0,0,0,0.7);
        overflow: hidden;
    }


    .cal-modal-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 15px 20px;
        background: #1a2127;
        border-bottom: 1px solid #2d3741;
    }

    .cal-modal-header h2 {
        margin: 0;
        font-size: 18px;
        color: var(--gold-light);
    }

    .cal-close-btn {
        background: none;
        border: none;
        color: #fff;
        font-size: 28px;
        cursor: pointer;
        line-height: 1;
    }
    .cal-close-btn:hover {
        color: var(--gold);
    }

    /* Layout Corpo a 2 Colonne */
    .cal-modal-body {
        display: grid;
        grid-template-columns: 300px 1fr;
        height: calc(80vh - 60px);
    }

    /* Sidebar Sinistra */
    .cal-sidebar {
        background: #161c22;
        border-right: 1px solid #2d3741;
        display: flex;
        flex-direction: column;
    }
    .cal-sidebar h3 {
        padding: 15px 15px 5px 15px;
        margin: 0;
        font-size: 14px;
        color: var(--ice-soft);
    }

    .cal-list-scroll {
        flex: 1;
        overflow-y: auto;
        padding: 10px;
    }

    .cal-sidebar-item {
        background: #1d252d;
        border-left: 3px solid var(--gold);
        padding: 10px;
        margin-bottom: 8px;
        border-radius: 0 4px 4px 0;
        cursor: pointer;
        transition: background 0.2s;
    }
    .cal-sidebar-item:hover {
        background: #26313b;
    }

    /* Calendario Principale a Destra */
    .cal-main {
        padding: 20px;
        display: flex;
        flex-direction: column;
        background: #12161a;
    }

    .cal-nav {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 15px;
    }
    .cal-nav button {
        background: #1a2127;
        border: 1px solid #444;
        color: #fff;
        padding: 5px 15px;
        cursor: pointer;
        border-radius: 4px;
    }
    .cal-nav button:hover {
        border-color: var(--gold);
        color: var(--gold);
    }

    .cal-grid-header {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        text-align: center;
        font-weight: bold;
        color: var(--gold-light);
        padding-bottom: 10px;
        border-bottom: 1px solid #2d3741;
    }

    .cal-grid-cells {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        grid-auto-rows: minmax(80px, 1fr);
        gap: 4px;
        margin-top: 5px;
        flex: 1;
    }

    /* Celle dei giorni */
    .cal-day-cell {
        background: #1a2127;
        border: 1px solid #232d37;
        padding: 5px;
        border-radius: 4px;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    .cal-day-cell.empty {
        background: #0f1316;
        border-color: transparent;
    }
    .cal-day-cell .day-num {
        font-size: 11px;
        color: #888;
        font-weight: bold;
        margin-bottom: 4px;
    }
    .cal-day-cell.today {
        border: 1px solid var(--gold);
        background: #1e242a;
    }
    .cal-day-cell.today .day-num {
        color: var(--gold);
    }

    /* Badge degli eventi dentro il calendario */
    .cal-event-badge {
        font-size: 9px;
        padding: 2px 4px;
        margin-bottom: 3px;
        border-radius: 3px;
        color: #fff;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-weight: bold;
    }