@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@300;400;600;700&display=swap');

:root {
    --bg-color: #030303;
    /* Glass Colors - DARK MODE */
    --glass-dark: rgba(0, 0, 0, 0.6);
    --glass-dark-thick: rgba(0, 0, 0, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);

    /* Neon Accents */
    --neon-blue: #00D1FF;
    --neon-magenta: #FF00E5;
    --neon-green: #3BFF8A;
    --neon-violet: #8B5CF6;

    /* Text Colors - WHITE CONTRAST */
    --text-primary: #FFFFFF;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;

    --glass-blur: blur(40px);
    --transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-soft: 0 15px 45px rgba(0, 0, 0, 0.4);
    --shadow-deep: 0 40px 80px rgba(0, 0, 0, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    overflow-x: hidden;
    line-height: 1.6;
    min-height: 100vh;
}

.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    background: url('../img/bg_bokeh.png') center/cover no-repeat;
    filter: brightness(0.6) blur(2px);
    animation: backgroundDrift 60s ease-in-out infinite alternate;
}

@keyframes backgroundDrift {
    0% {
        transform: scale(1) translate(0, 0);
        filter: brightness(0.4) blur(2px);
    }

    50% {
        transform: scale(1.1) translate(-2%, -5%);
        filter: brightness(0.7) blur(1px);
    }

    100% {
        transform: scale(1.05) translate(2%, 5%);
        filter: brightness(0.5) blur(2px);
    }
}

.gradient-text {
    background: linear-gradient(135deg, var(--neon-green), var(--neon-violet));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

h1,
h2,
h3,
.logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
}

/* --- Layout --- */
.app-container {
    display: flex;
    min-height: 100vh;
    padding: 1.5rem;
    gap: 1.5rem;
}

/* --- Login Gate & Neo-Form --- */
#login-gate {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 100vh;
}

.neo-form {
    background: var(--glass-dark);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 3rem;
    color: white;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.neo-info {
    z-index: 10;
}

.neo-info h1 {
    color: white;
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.neo-info p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.neo-input-group {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.neo-input-wrapper {
    position: relative;
    flex: 1;
    overflow: hidden;
    border-radius: 12px;
}

.neo-input-wrapper input {
    width: 100%;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.875rem 1.25rem;
    color: white;
    outline: none;
    font-size: 0.9375rem;
    transition: var(--transition);
}

.neo-input-wrapper input:focus {
    border-color: var(--sapphire-blue);
    background: rgba(0, 0, 0, 0.6);
    box-shadow: 0 0 20px rgba(0, 209, 255, 0.1);
}

.neo-btn {
    background: var(--sapphire-blue);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    padding: 0 1.5rem;
    height: 48px;
    font-family: 'Outfit';
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.neo-btn:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 209, 255, 0.2);
}

/* --- Sidebar --- */
.sidebar-floating {
    width: 300px;
    background: var(--glass-dark);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    /* Thin neon white border */
    border-radius: 30px;
    padding: 2.5rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 1.5rem;
    height: calc(100vh - 3rem);
    z-index: 100;
    box-shadow: var(--shadow-deep);
}

.logo-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 14px;
    color: white;
    filter: drop-shadow(0 0 10px var(--neon-blue)) drop-shadow(0 0 10px var(--neon-magenta));
}

.logo-text {
    font-size: 1.75rem;
    letter-spacing: 0.1em;
    color: white;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-btn {
    background: transparent;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.25rem 1.5rem;
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-btn.active {
    background: rgb(24, 220, 220);
    color: var(--text-primary);
    box-shadow: 0 10px 25px rgba(255, 255, 255, 0.2);
}

.nav-btn.active i {
    filter: none;
    color: inherit;
}

.nav-btn[data-view="panoramica"].active {
    box-shadow: 0 0 20px rgba(0, 209, 255, 0.4);
}

.nav-btn[data-view="generazione"].active {
    box-shadow: 0 0 20px rgba(255, 0, 229, 0.4);
}

.nav-btn[data-view="visualizza"].active {
    box-shadow: 0 0 20px rgba(59, 255, 138, 0.4);
}

.sidebar-footer {
    margin-top: auto;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: var(--transition);
}

.logout-link:hover {
    color: var(--hot-pink);
}

/* --- Main Viewport --- */
.main-viewport {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.header {
    background: var(--panel-bg);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 1.5rem 2rem;
}

.header-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.system-status {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid white;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 100px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: var(--cyber-lime);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--cyber-lime);
    animation: pulse 2s infinite;
}

.status-text {
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* --- Views --- */
.view-content {
    display: none;
}

.view-content.active {
    display: block;
}

/* --- Panels & Glows --- */
.glass-panel {
    background: var(--glass-dark);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 2.5rem;
    box-shadow: var(--shadow-deep);
    color: var(--text-primary);
}

.glow-blue {
    border-color: var(--neon-blue) !important;
    box-shadow: 0 0 20px rgba(0, 209, 255, 0.15), var(--shadow-deep);
}

.glow-magenta {
    border-color: var(--neon-magenta) !important;
    box-shadow: 0 0 20px rgba(255, 0, 229, 0.15), var(--shadow-deep);
}

.glow-green {
    border-color: var(--neon-green) !important;
    box-shadow: 0 0 20px rgba(59, 255, 138, 0.15), var(--shadow-deep);
}

.stat-card.glow-green {
    border: 1px solid var(--neon-green);
}

.event-card {
    background: var(--glass-dark-thick);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    box-shadow: var(--shadow-deep);
    color: var(--text-primary);
}

.central-form-panel {
    max-width: 800px;
    margin: 0 auto;
}

.panel-title {
    color: var(--text-primary);
    font-weight: 800;
    text-transform: uppercase;
    font-size: 1.25rem;
    letter-spacing: 0.15em;
    margin-bottom: 2.5rem;
    text-align: center;
    position: relative;
}

.panel-title::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 2px;
    background: var(--sapphire-blue);
    box-shadow: 0 0 10px var(--sapphire-blue);
}

/* --- Bento Grid --- */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.stat-card {
    background: var(--glass-dark-thick);
    color: var(--text-primary);
    position: relative;
    overflow: hidden;
    padding: 2rem;
}

.stat-label {
    color: var(--text-muted);
    font-weight: 600;
    display: block;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.stat-value {
    color: var(--text-primary);
    font-weight: 900;
    font-size: 2.5rem;
    font-family: 'Outfit';
}

.stat-icon {
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    font-size: 2rem;
    opacity: 0.15;
}

.stat-icon.blue {
    color: var(--sapphire-blue);
}

.stat-icon.magenta {
    color: var(--hot-pink);
}

.stat-icon.green {
    color: var(--cyber-lime);
}

.welcome-card {
    grid-column: span 3;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
}

.welcome-card h3 {
    font-size: 2.25rem;
    color: var(--text-primary);
}

/* --- Forms --- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.input-group label {
    color: var(--text-secondary);
    font-weight: 800;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

input,
select,
textarea {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    color: white;
    font-weight: 500;
    border-radius: 16px;
    padding: 1rem 1.25rem;
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input::placeholder {
    color: var(--text-muted);
}

select option {
    background: #000000;
    color: white;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(0, 209, 255, 0.4);
    box-shadow: 0 0 20px rgba(0, 209, 255, 0.1);
}

.glow-blue input:focus,
.glow-blue select:focus {
    border-color: var(--sapphire-blue);
    box-shadow: 0 0 15px rgba(0, 209, 255, 0.2);
}

.glow-purple input:focus,
.glow-purple textarea:focus {
    border-color: var(--electric-violet);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.2);
}

/* --- Buttons --- */
.btn-primary {
    width: 100%;
    background: var(--neon-magenta);
    box-shadow: 0 15px 35px rgba(255, 0, 229, 0.3);
    color: white;
    font-weight: 800;
    border: none;
    border-radius: 18px;
    padding: 1.25rem;
    font-family: 'Outfit';
    font-size: 1rem;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.btn-magenta-glow {
    background: linear-gradient(135deg, var(--hot-pink), #8800ff);
    box-shadow: 0 15px 35px rgba(255, 0, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    filter: brightness(1.1);
}

.btn-outline {
    border-color: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    background: transparent;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline:hover {
    background: black;
    color: white;
}

/* --- Visualizza Eventi --- */
.full-width-panel {
    width: 100%;
}

.panel-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.panel-header-row .panel-title {
    margin-bottom: 0;
    text-align: left;
}

.panel-header-row .panel-title::after {
    left: 0;
    transform: none;
}

.compact {
    margin-bottom: 0;
}

.event-grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
}

/* --- Event Card --- */
.event-card {
    background: var(--glass-white-thick);
    border: 2px solid white;
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.event-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--sapphire-blue);
    box-shadow: 0 0 10px var(--sapphire-blue);
}

.event-card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.event-card.techno::before {
    background: var(--electric-violet);
    box-shadow: 0 0 10px var(--electric-violet);
}

.event-card.trap::before {
    background: var(--hot-pink);
    box-shadow: 0 0 10px var(--hot-pink);
}

.event-card.commerciale::before {
    background: var(--cyber-lime);
    box-shadow: 0 0 10px var(--cyber-lime);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.event-id {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 800;
}

.status-badge {
    background: white;
    color: black;
    border-color: black;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
}

.data-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.data-item {
    display: flex;
    flex-direction: column;
}

.data-label {
    color: var(--text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    font-weight: 700;
}

.data-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.875rem;
}

.event-description {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.875rem;
    padding: 1rem;
    border-radius: 12px;
    line-height: 1.5;
}

/* --- Modal --- */
#results-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(15px);
    z-index: 1000;
    padding: 2rem;
}

.modal-content {
    background: #0a0a0a;
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    max-width: 700px;
    margin: 2rem auto;
    max-height: 85vh;
    overflow-y: auto;
    padding: 3rem;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header h3 {
    color: var(--text-primary);
}

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive */
@media (max-width: 1200px) {
    .sidebar-floating {
        width: 260px;
    }

    .event-grid-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        padding: 1rem;
    }

    .sidebar-floating {
        width: 100%;
        height: auto;
        position: relative;
        top: 0;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

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

/* --- Performance Gauge --- */
.performance-score {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.gauge-container {
    position: relative;
    width: 100px;
    height: 100px;
}

.gauge {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.gauge-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.05);
    stroke-width: 8;
}

.gauge-value {
    fill: none;
    stroke: var(--neon-green);
    stroke-width: 8;
    stroke-dasharray: 283;
    stroke-dashoffset: 45;
    stroke-linecap: round;
    filter: drop-shadow(0 0 5px var(--neon-green));
}

.gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-primary);
}

.score-num {
    font-size: 1.5rem;
    font-weight: 900;
    font-family: 'Outfit';
}

.score-label {
    font-size: 0.6rem;
    font-weight: 800;
    opacity: 0.6;
}

/* --- Sparklines --- */
.sparkline {
    width: 80px;
    height: 30px;
}

.sparkline.blue {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 30'%3E%3Cpath d='M0,25 Q15,5 30,20 T80,5' fill='none' stroke='%2300D1FF' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
}

.sparkline.magenta {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 30'%3E%3Cpath d='M0,15 Q20,25 40,5 T80,15' fill='none' stroke='%23FF00E5' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
}

.sparkline.green {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 30'%3E%3Cpath d='M0,20 Q10,10 30,25 T80,5' fill='none' stroke='%233BFF8A' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
}