/* ===== Global Reset ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #0e0e0e url("https://www.transparenttextures.com/patterns/dark-stripes.png");
    background-attachment: fixed;
    color: #e0e0e0;
    line-height: 1.6;
}

/* ===== Containers (Liquid Glass) ===== */
.container, .card, .box, .dashboard-widget, .content-box, .glass-card {
    background: rgba(25, 25, 25, 0.65);
    backdrop-filter: blur(14px) saturate(120%);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.6);
    padding: 20px;
    margin: 15px auto;
    border: 1px solid rgba(255,255,255,0.08);
    position: relative;
    z-index: 1;
}

/* ===== Navbar ===== */
.navbar {
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.navbar a {
    color: #ddd;
    text-decoration: none;
    margin: 0 12px;
    transition: color 0.3s, text-shadow 0.3s;
}
.navbar a:hover {
    color: #00bcd4;
    text-shadow: 0 0 8px #00bcd4;
}

/* Blocca completamente lo scroll del body quando la sidebar è aperta */
.body-locked {
  position: fixed;
  overflow: hidden;
  width: 100%;
}

/* ===== Sidebar e Overlay Fix ===== */
#sidebar {
  background: rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(14px) saturate(120%) !important;
  -webkit-backdrop-filter: blur(14px) saturate(120%) !important;
  border: 1px solid rgba(255,255,255,0.18);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  position: fixed !important;
  z-index: 2000 !important;
}
#overlay {
  position: fixed !important;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background-color: rgba(0,0,0,0.5);
  z-index: 1500 !important;
}
main, footer, .glass-card, .content {
  position: relative;
  z-index: 1;
}

/* Sidebar links */
#sidebar .menu-section-title {
  color: #cbd3da;
  letter-spacing: .02em;
}
#sidebar a, #sidebar .nav-link, #sidebar .list-group-item {
  color: #e9ecef !important;
  background: transparent;
  border: none;
  display: block;
  padding: 12px 16px;
  border-radius: 14px;
  position: relative;
  overflow: hidden;
  transition: transform .2s ease, background .3s ease, box-shadow .3s ease, color .3s ease;
  isolation: isolate;
}
#sidebar a::before, #sidebar .nav-link::before, #sidebar .list-group-item::before {
  content: "";
  position: absolute;
  inset: -120%;
  background: radial-gradient(120px 120px at var(--mx,50%) var(--my,50%), rgba(255,255,255,0.25), transparent 60%);
  opacity: 0;
  transition: opacity .25s ease;
  z-index: -1;
}
#sidebar a:hover, #sidebar .nav-link:hover, #sidebar .list-group-item:hover {
  transform: translateY(-2px);
  color: #ffffff !important;
  background: rgba(255,255,255,0.06);
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
#sidebar a:hover::before,
#sidebar .nav-link:hover::before,
#sidebar .list-group-item:hover::before {
  opacity: 1;
}
#sidebar a.active, #sidebar .nav-link.active, #sidebar .list-group-item.active {
  background: rgba(255,255,255,0.12) !important;
  color: #ffffff !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18);
}

/* ===== Buttons ===== */
button, .btn {
    background: linear-gradient(135deg, #222, #333);
    border: 1px solid #444;
    border-radius: 10px;
    padding: 10px 22px;
    color: #eee;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
}
button:hover, .btn:hover {
    background: linear-gradient(135deg, #333, #444);
    border-color: #00bcd4;
    color: #00bcd4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,188,212,0.25);
}

/* ===== Dashboard Cards ===== */
.stat-card {
    text-align: center;
    padding: 20px;
    border-radius: 14px;
    background: rgba(40,40,40,0.7);
    transition: transform 0.3s, box-shadow 0.3s;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0,188,212,0.2);
}
.stat-card h3 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: #00bcd4;
}
.stat-card .value {
    font-size: 2.2em;
    font-weight: bold;
}

/* ===== Tables ===== */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 0.95em;
    border-radius: 14px;
    overflow: hidden;
}
table thead {
    background: rgba(40, 40, 40, 0.95);
    color: #00bcd4;
    font-weight: 600;
}
table th, table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
table tr:nth-child(even) {
    background: rgba(255,255,255,0.03);
}
table tr:hover {
    background: rgba(0,188,212,0.08);
}
.table-empty {
    text-align: center;
    color: #bbb;
    font-style: italic;
    padding: 20px;
}

/* ===== Forms ===== */
form {
    background: rgba(20,20,20,0.6);
    backdrop-filter: blur(12px);
    padding: 25px;
    border-radius: 16px;
}
.form-label {
    font-weight: 600;
    color: #f1f1f1;
    margin-bottom: 6px;
}
input, select, textarea {
    background: rgba(30,30,30,0.8);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    padding: 12px 14px;
    color: #eee;
    width: 100%;
    margin-bottom: 15px;
    transition: border 0.3s, box-shadow 0.3s;
    font-size: 0.95em;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #00bcd4;
    box-shadow: 0 0 8px rgba(0,188,212,0.3);
}

/* Pulsanti form allineati */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* ===== Login Page ===== */
.login-box {
    max-width: 400px;
    margin: 80px auto;
    text-align: center;
    background: rgba(25,25,25,0.7);
    padding: 30px;
    border-radius: 20px;
    backdrop-filter: blur(15px);
}
.login-box h2 {
    margin-bottom: 20px;
    color: #00bcd4;
}
.login-box input {
    margin-bottom: 20px;
}
.login-box button {
    width: 100%;
}

/* ===== Footer (Sticky + Glass) ===== */
.glass-footer {
    background: rgba(25, 25, 25, 0.75);
    backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255,255,255,0.1);
    color: #ccc;
    font-size: 0.85em;
    margin-top: auto;
}

/* ===== Overrides ===== */
.form-text { color: #e9ecef !important; }
.form-control::placeholder { color: rgba(255,255,255,0.6); }

/* ===== Login Titles Fix ===== */
.login-box h1,
.login-box h2,
.login-box h3,
.login-box .card-title,
.login-box .text-secondary,
.container.login-container h1,
.container.login-container h2,
.container.login-container h3,
.card.login-card h1,
.card.login-card h2,
.card.login-card h3 {
  color: #ffffff !important;
  text-shadow: 0 2px 6px rgba(0,0,0,0.55);
}
.card.login-card > h3 {
  color: #ffffff !important;
  text-shadow: 0 2px 6px rgba(0,0,0,0.55);
}

/* ===== Modal Fix ===== */
.modal { z-index: 2100 !important; }
.modal-backdrop { z-index: 2090 !important; }
.modal .form-control {
  background-color: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.18);
  color: #f8f9fa;
}

/* ===== Resoconti Interattivi ===== */
.resoconti-list {
  max-height: 420px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.resoconti-list::-webkit-scrollbar { width: 6px; }
.resoconti-list::-webkit-scrollbar-thumb {
  background: rgba(0, 188, 212, 0.5);
  border-radius: 10px;
}
.resoconto-item {
  background: rgba(20,20,20,0.6);
  border: 1px solid rgba(255,255,255,0.08);
  transition: transform 0.2s, box-shadow 0.2s;
}
.resoconto-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0,188,212,0.3);
}

/* ===== Messaggi vuoti leggibili ===== */
.table-empty,
.text-muted,
.empty-message {
  color: #e0e0e0 !important;
  font-style: italic;
  text-align: center;
  opacity: 0.9;
}

/* ===== Fix container Modifica Utente ===== */
.container.form-page {
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  margin-top: 40px;
}

.user-edit-card {
  background: rgba(25, 25, 25, 0.75);
  backdrop-filter: blur(14px) saturate(120%);
  border-radius: 18px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.55);
  padding: 30px;
}

/* ===== Modal interaction ===== */
body.modal-open main,
body.modal-open #sidebar,
body.modal-open #topbar,
body.modal-open footer {
  pointer-events: none !important;
}
body.modal-open .modal,
body.modal-open .modal * {
  pointer-events: auto !important;
}