/* Vibrant Glassmorphism Theme */
:root {
  --color-primary: #6366f1;    /* Indigo */
  --color-secondary: #64748b;  /* Slate */
  --color-success: #10b981;    /* Emerald */
  --color-warning: #f59e0b;    /* Amber */
  --color-danger: #f43f5e;     /* Rose */
  --color-info: #8b5cf6;       /* Violet */
  --color-bg: #0f172a;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-highlight: rgba(255, 255, 255, 0.2);
  
  --gradient-primary: linear-gradient(135deg, var(--color-primary) 0%, #a855f7 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
  --gradient-danger: linear-gradient(135deg, #f43f5e 0%, #fb7185 100%);
  --gradient-mesh: radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
                   radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
                   radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);

  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
}

.access-banner {
  font-family: 'Outfit', sans-serif;
  font-size: 11px;
  font-weight: 800;
  color: white;
  text-align: center;
  padding: 12px 0;
  background: #10b981; /* Emerald Green */
  text-transform: uppercase;
  letter-spacing: 0.15em;
  z-index: 1000;
  width: 100%;
}

.version-tag {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.2);
  pointer-events: none;
  z-index: 50;
  text-transform: uppercase;
  letter-spacing: 1px;
}

html, body {
  margin: 0; padding: 0; min-height: 100vh;
  font-family: 'Outfit', sans-serif;
  background-color: var(--color-bg);
  background-image: var(--gradient-mesh);
  background-attachment: fixed;
  color: var(--text-main);
  overflow-x: hidden;
  transition: background-color 0.5s ease;
}

/* ── LAYOUT ── */
.app-container {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.main-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevent flex blowout */
  padding: 20px;
}

body.light-theme {
  --text-main: #0f172a;
  --text-muted: #475569;
  --glass-bg: rgba(0, 0, 0, 0.03);
  --glass-border: rgba(0, 0, 0, 0.08);
  --glass-highlight: rgba(0, 0, 0, 0.1);
  background-image: none;
  background-color: #f1f5f9;
}

/* Glass Components */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

/* Sidebar */
#sidebar {
  width: 280px;
  min-width: 280px;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
  border-radius: 0;
  border-left: none;
  border-top: none;
  border-bottom: none;
  background: rgba(15, 23, 42, 0.8);
  z-index: 1001;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#sidebar.compact {
  width: 80px;
  min-width: 80px;
  padding: 30px 5px;
}

#sidebar.compact .studio-name,
#sidebar.compact .studio-sub,
#sidebar.compact .sidebar-nav button span {
  display: none;
}

#sidebar.compact .sidebar-nav button {
  justify-content: center;
  gap: 0;
  padding: 15px 0;
}

#sidebar.compact .sidebar-header {
  text-align: center;
  margin-bottom: 30px;
}

.sidebar-header {
  margin-bottom: 40px;
  padding: 0 10px;
}

.sidebar-header .studio-name {
  font-size: 1.4rem;
  margin: 0;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-header .studio-sub {
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 4px;
  text-transform: uppercase;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.sidebar-nav button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 14px 18px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  cursor: pointer;
}

.sidebar-nav button:hover {
  background: var(--glass-highlight);
  color: #fff;
  transform: translateX(5px);
}

.sidebar-nav button.active {
  background: var(--gradient-primary);
  color: #fff;
  border-color: rgba(255,255,255,0.1);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.sidebar-nav button svg {
  transition: transform 0.3s;
}

.sidebar-nav button:hover svg {
  transform: scale(1.1);
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--glass-border);
}

/* Header (now a top bar) */
header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 20px;
  background: transparent;
  backdrop-filter: none;
  border-bottom: none;
  position: relative; top: auto; z-index: 100;
}

.studio-brand { display: flex; align-items: center; gap: 15px; }
.studio-logo { 
  width: 50px; height: 50px; border-radius: 12px; 
  object-fit: cover; border: 2px solid var(--glass-highlight);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}
.studio-name { font-size: 1.5rem; font-weight: 700; color: #fff; letter-spacing: -0.5px; }

.user-info { display: flex; align-items: center; gap: 15px; font-weight: 500; font-size: 0.95rem; }
.role-badge { 
  font-size: 0.75rem; font-weight: 800; padding: 6px 14px; border-radius: 30px; 
  text-transform: uppercase; letter-spacing: 1px;
  background: var(--glass-highlight); color: #fff;
}
/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.3); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--color-primary); }
.role-admin { background: var(--gradient-primary); box-shadow: 0 0 10px rgba(99, 102, 241, 0.4); }

/* Settings Dropdown */
.settings-dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute; left: 0; top: 100%; margin-top: 15px;
  width: 260px; max-height: 80vh; overflow-y: auto;
  background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(25px);
  border: 1px solid var(--glass-border); border-radius: 18px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5);
  display: none; flex-direction: column; z-index: 2000;
  animation: slideIn 0.2s ease-out;
}
.sidebar-footer .dropdown-menu {
  top: auto;
  bottom: 100%;
  margin-top: 0;
  margin-bottom: 15px;
  left: 0;
  right: auto;
  box-shadow: 0 -15px 35px rgba(0,0,0,0.5);
  animation: slideUp 0.2s ease-out;
}
.dropdown-menu::-webkit-scrollbar { width: 4px; }
.dropdown-menu::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.settings-dropdown:hover .dropdown-menu,
.settings-dropdown.active .dropdown-menu { display: flex; }
.dropdown-item {
  padding: 15px 20px; color: #94a3b8; font-size: 0.85rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer; transition: all 0.2s; text-align: left; background: none; border-left: none; border-right: none;
  position: relative; z-index: 2001; pointer-events: auto;
}
.dropdown-item:last-child { border-bottom: none; }
.dropdown-item:hover { background: rgba(255,255,255,0.05); color: #fff; padding-left: 25px; }
.dropdown-item * { pointer-events: none; } /* Ensure sub-elements don't capture click, handled by closest() anyway but safer */
.dropdown-item i { margin-right: 10px; width: 20px; text-align: center; }

/* Dynamic Nav Dropdown Styling */
#main-nav .settings-dropdown {
  display: flex;
  align-items: center;
}

#main-nav .dropdown-menu {
  left: auto;
  right: 0;
  width: 300px;
}

/* For dropdowns in the middle, use specific rules */
#contabilita-generale-dropdown .dropdown-menu {
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) translateY(10px) !important;
  display: none;
}
#contabilita-generale-dropdown.active .dropdown-menu {
  display: flex !important;
}

#btn-contabilita-generale {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

#btn-contabilita-generale::after {
  content: '▾';
  font-size: 0.8rem;
  opacity: 0.5;
}

/* Navigation */
nav { 
  display: flex; 
  gap: 5px; 
  background: rgba(0,0,0,0.2); 
  padding: 5px; 
  border-radius: 30px; 
  overflow-x: auto; 
  white-space: nowrap;
  scrollbar-width: none; 
  -ms-overflow-style: none;
}
nav::-webkit-scrollbar { display: none; }

nav button {
  flex-shrink: 0;
  background: none; border: none; color: #94a3b8; padding: 10px 24px;
  cursor: pointer; font-weight: 600; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.95rem; border-radius: 25px;
}
nav button.active { 
  background: var(--glass-highlight); color: #fff; 
  box-shadow: 0 4px 15px rgba(255,255,255,0.05);
}
nav button:hover:not(.active) { color: #fff; background: rgba(255,255,255,0.05); }

/* Responsiveness Fixes */
@media (max-width: 1280px) {
  header { 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 15px; 
    padding: 15px;
    height: auto;
  }
  .studio-brand { order: 1; margin-bottom: 5px; }
  .user-info { order: 2; margin-bottom: 5px; }
  nav { 
    order: 3; 
    width: 100%; 
    flex-wrap: wrap; 
    justify-content: center; 
    white-space: normal;
    overflow-x: visible;
    background: rgba(0,0,0,0.15);
    padding: 10px;
    border-radius: 20px;
  }
  nav button {
    flex-shrink: 1; /* Allow shrinking if needed */
  }
}

@media (max-width: 1400px) {
  header { padding: 10px 15px; }
  .studio-name { font-size: 1rem; }
  nav button { padding: 8px 15px; }
  nav button span { font-size: 13px; }
}

@media (max-width: 992px) {
  /* Hide labels on medium-small screens to save space */
  nav button span { display: none; }
  nav button { padding: 12px; }
}

@media (max-width: 768px) {
  .studio-name { display: none; }
  .user-info span:not(.role-badge) { display: none; }
  html { font-size: 13px; }
  
  .settings-dropdown button { font-size: 1.4rem; padding: 5px; }
}

@media (max-width: 480px) {
  html { font-size: 12px; }
  header { padding: 5px; }
  .studio-logo { width: 35px; height: 35px; }
}

/* Toast Notifications */
#toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: rgba(15, 23, 42, 0.95); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1); border-radius: 12px;
  padding: 12px 20px; color: white; min-width: 250px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  font-weight: 700; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.toast.success { border-left: 4px solid #10b981; }
.toast.info { border-left: 4px solid #6366f1; }
.toast.error { border-left: 4px solid #ef4444; }

@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Pulse Loader */
.pulse-loader {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--color-primary);
  animation: pulse-ring 1.25s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
@keyframes pulse-ring { 0% { transform: scale(.33); } 80%, 100% { opacity: 0; } }


/* Main Content Area */
#main-content { padding: 40px; max-width: 1600px; margin-left: 0; margin-right: auto; width: 100%; box-sizing: border-box; }

/* Landing / Login Centering */
.landing-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  padding: 40px 20px;
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  text-align: center;
  animation: fadeInScale 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Buttons */
button.btn-primary { 
  display: inline-flex; align-items: center; justify-content: center;
  padding: 16px 28px; border-radius: var(--radius-md); font-weight: 700; font-size: 1rem;
  border: none; cursor: pointer; transition: all 0.3s;
  background: var(--gradient-primary); color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}
button.btn-primary:hover { 
  transform: translateY(-2px) scale(1.02); 
  box-shadow: 0 8px 25px rgba(99, 102, 241, 0.5);
}
button.btn-primary:active { transform: translateY(0) scale(0.98); }

/* Tables */
.table-container { 
  background: var(--glass-bg); border-radius: var(--radius-lg); 
  overflow: hidden; border: 1px solid var(--glass-border); margin-top: 30px;
}
table { width: 100%; border-collapse: collapse; }
th { 
  background: rgba(255, 255, 255, 0.03); color: #94a3b8; 
  text-transform: uppercase; font-size: 0.75rem; padding: 20px; font-weight: 800; 
  text-align: left; letter-spacing: 1px;
}
td { padding: 18px 20px; border-bottom: 1px solid var(--glass-border); font-size: 1rem; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

.badge { 
  font-size: 0.75rem; font-weight: 800; padding: 6px 12px; border-radius: 8px; 
  color: white; text-transform: uppercase;
}

/* Forms */
input, select {
  width: 100%; box-sizing: border-box; padding: 16px; border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.2); color: #fff; border: 1px solid var(--glass-border);
  outline: none; margin-bottom: 20px; font-size: 1rem; transition: all 0.3s;
}
input:focus, select:focus { 
  border-color: var(--color-primary); 
  background: rgba(0, 0, 0, 0.4);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

/* Progress Bar */
#progress-container, #template-progress-container {
  height: 12px; background: rgba(0,0,0,0.3); border-radius: 10px; overflow: hidden;
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.2);
}
#progress-bar, #template-progress-bar {
  background: var(--gradient-primary);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
}

/* Cards & Grid */
.details-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.detail-item { 
  background: rgba(255,255,255,0.02); padding: 20px; border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}
.detail-item label { font-size: 0.7rem; font-weight: 800; color: #64748b; text-transform: uppercase; display: block; margin-bottom: 8px; }
.detail-item span { font-size: 1.15rem; font-weight: 600; color: #fff; }

/* Modal System (Native fallback for Tailwind classes) */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center; z-index: 2000; padding: 20px;
}
.modal-container {
  width: 100%; max-width: 750px; max-height: 80vh;
  display: flex; flex-direction: column; overflow: hidden;
  position: relative;
}
.modal-header { display: flex; border-bottom: 1px solid var(--glass-border); }
.modal-content { padding: 40px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 30px; border-top: 1px solid var(--glass-border); background: rgba(0,0,0,0.2); display: flex; justify-content: flex-end; }

/* Injected Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.max-w-4xl { max-width: 750px; }
.hidden { display: none !important; }
.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.fixed { position: fixed; }
.absolute { position: absolute; }
.relative { position: relative; }
.z-50 { z-index: 50; }
.p-0 { padding: 0; }
.p-4 { padding: 1rem; }
.p-8 { padding: 2rem; }
.p-10 { padding: 2.5rem; }
.px-8 { padding-left: 2rem; padding-right: 2rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.ml-4 { margin-left: 1rem; }
.ml-auto { margin-left: auto; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-10 { margin-top: 2.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.gap-8 { gap: 2rem; }
.bg-black\/20 { background: rgba(0,0,0,0.2); }
.bg-black\/40 { background: rgba(0,0,0,0.4); }
.border-b { border-bottom: 1px solid var(--glass-border); }
.border-t { border-top: 1px solid var(--glass-border); }
.rounded-xl { border-radius: var(--radius-md); }
.text-2xl { font-size: 1.5rem; }
.font-black { font-weight: 900; }
.font-bold { font-weight: 700; }
.tracking-tighter { letter-spacing: -0.05em; }
.tracking-widest { letter-spacing: 0.1em; }
.uppercase { text-transform: uppercase; }
.overflow-y-auto { overflow-y: auto; }
.flex-1 { flex: 1 1 0%; }


/* Authentication & Landing Screens */
.landing-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--gradient-mesh);
  background-attachment: fixed;
}

.auth-card {
  width: 100%;
  max-width: 450px;
  text-align: center;
  padding: 50px;
  animation: fadeInScale 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.auth-card h1, .auth-card h2 {
  font-size: 2.2rem;
  font-weight: 900;
  margin-bottom: 10px;
  letter-spacing: -1px;
  background: linear-gradient(to bottom, #fff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.auth-card p {
  color: #94a3b8;
  margin-bottom: 30px;
}

.studio-logo {
  width: 100px;
  height: 100px;
  margin: 0 auto 20px;
  border-radius: 24px;
  object-fit: cover;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  border: 2px solid var(--glass-highlight);
}

/* Animations */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Utilities */
.rbac-hidden { display: none !important; }
.text-xs { font-size: 0.75rem; }
.font-black { font-weight: 900; }
.tracking-widest { letter-spacing: 0.1em; }
/* Subject Selection Cards */
.subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 40px;
}

.subject-card {
  padding: 40px 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0.07) 100%);
  border: 1px solid rgba(255,255,255,0.1);
}

.subject-card:hover {
  transform: translateY(-10px);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.1) 100%);
  border-color: var(--color-primary);
  box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 20px rgba(99, 102, 241, 0.2);
}

.subject-icon {
  font-size: 3rem;
  filter: drop-shadow(0 5px 15px rgba(0,0,0,0.3));
  transition: transform 0.3s;
}

.subject-card:hover .subject-icon {
  transform: scale(1.2);
}

.subject-title {
  font-size: 1.1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #fff;
}

.subject-count {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0,0,0,0.2);
  padding: 4px 12px;
  border-radius: 20px;
  margin-top: 5px;
}

.back-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85rem;
  transition: color 0.3s;
  margin-bottom: 20px;
}

.back-btn:hover {
  color: #fff;
}

/* Envelope Running Away Animation */
@keyframes scappaVia {
  0% { transform: translateX(0) scale(1.1) rotate(0deg); }
  25% { transform: translateX(10px) scale(1.1) rotate(15deg); }
  50% { transform: translateX(5px) scale(1.1) rotate(5deg); }
  75% { transform: translateX(15px) scale(1.1) rotate(20deg); }
  100% { transform: translateX(0) scale(1.1) rotate(0deg); }
}

#btn-comms, #nav-comms {
  font-size: 1.2rem;
  transition: transform 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#btn-comms:hover, #nav-comms:hover {
  animation: scappaVia 0.5s ease-in-out infinite;
}
/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255,255,255,0.1);
  transition: .4s;
  border-radius: 34px;
  border: 1px solid rgba(255,255,255,0.1);
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}
.switch input:checked + .slider { background-color: #f43f5e; }
.switch input:focus + .slider { box-shadow: 0 0 1px #f43f5e; }
.switch input:checked + .slider:before { transform: translateX(20px); }

@keyframes blink-red {
  0% { background-color: rgba(244, 63, 94, 0.2); border-color: rgba(244, 63, 94, 0.5); }
  50% { background-color: rgba(244, 63, 94, 0.6); border-color: #f43f5e; }
  100% { background-color: rgba(244, 63, 94, 0.2); border-color: rgba(244, 63, 94, 0.5); }
}
.blink-warning {
  animation: blink-red 1s infinite;
  color: white;
  padding: 10px;
  border-radius: 8px;
  font-weight: 900;
  text-transform: uppercase;
  font-size: 0.7rem;
  text-align: center;
  border: 2px solid transparent;
}

/* Outlook View Columns Highlighting */
.outlook-pane-1 { 
  background: rgba(10, 15, 25, 0.9) !important; 
  border-right: 2px solid rgba(255,255,255,0.1) !important;
  box-shadow: 10px 0 15px -10px rgba(0,0,0,0.5);
}
.outlook-pane-2 { 
  background: rgba(15, 23, 42, 0.4) !important; 
  border-right: 2px solid rgba(255,255,255,0.1) !important;
  box-shadow: 10px 0 15px -10px rgba(0,0,0,0.5);
}
.outlook-pane-3 { 
  background: #050507 !important; 
}

.active-message {
  background: linear-gradient(90deg, rgba(99, 102, 241, 0.1) 0%, rgba(99, 102, 241, 0.05) 100%) !important;
  border-left: 5px solid #6366f1 !important;
  border-radius: 0 12px 12px 0 !important;
  box-shadow: inset 0 0 20px rgba(99, 102, 241, 0.1);
}

.message-item-container {
  transition: all 0.2s;
  border-bottom: 1px solid rgba(255,255,255,0.03);
}

/* Client Selector Styles */
.client-item-row {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.client-item-row:hover {
  background: rgba(99, 102, 241, 0.1);
  border-color: rgba(99, 102, 241, 0.3);
  transform: translateX(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.message-item-container:hover:not(.active-message) {
  background: rgba(255,255,255,0.03) !important;
}

/* Responsive Sidebar */
@media (max-width: 1024px) {
  .app-container { flex-direction: column; }
  #sidebar { 
    width: 100%; height: auto; position: relative; 
    flex-direction: row; align-items: center; justify-content: space-between;
    padding: 15px 20px;
    min-width: 0;
  }
  .sidebar-header { margin-bottom: 0; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; gap: 5px; flex: none; }
  .sidebar-nav button { padding: 8px 12px; font-size: 0.8rem; flex-shrink: 0; }
  .sidebar-nav button span { display: none; }
  .sidebar-footer { margin-top: 0; padding-top: 0; border-top: none; }
  .main-wrapper { padding: 10px; }
}

/* Utility Classes */
.text-white { color: #ffffff !important; }
.text-amber-500 { color: #f59e0b !important; }
.text-amber-600 { color: #d97706 !important; }
.text-indigo-400 { color: #818cf8 !important; }
.text-indigo-500 { color: #6366f1 !important; }
.text-gray-400 { color: #94a3b8 !important; }
.text-gray-500 { color: #64748b !important; }
.text-gray-600 { color: #475569 !important; }

.bg-black\/40 { background-color: rgba(0, 0, 0, 0.4) !important; }
.bg-amber-600 { background-color: #d97706 !important; }
.hover\:bg-amber-500:hover { background-color: #f59e0b !important; }

.border-white\/5 { border-color: rgba(255, 255, 255, 0.05) !important; }
.animate-fade-in { animation: fadeIn 0.5s ease-out; }

/* SMS Hub Specifics */
#sms-to, #sms-body, #sms-type {
  color: #ffffff !important;
  background-color: rgba(0, 0, 0, 0.5) !important;
}
#sms-to::placeholder, #sms-body::placeholder {
  color: rgba(255, 255, 255, 0.4) !important;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Comunicazioni UI Enhanced Utilities */
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.w-14 { width: 3.5rem; }
.h-14 { height: 3.5rem; }
.w-16 { width: 4rem; }
.h-16 { height: 4rem; }
.rounded-3xl { border-radius: 24px; }
.text-4xl { font-size: 2.25rem; line-height: 2.5rem; }
.text-5xl { font-size: 3rem; line-height: 1; }
.text-6xl { font-size: 3.75rem; line-height: 1; }
.gap-10 { gap: 2.5rem; }
.gap-12 { gap: 3rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-10 { margin-bottom: 2.5rem; }
.mb-16 { margin-bottom: 4rem; }
.mt-16 { margin-top: 4rem; }
.pt-6 { padding-top: 1.5rem; }
.pb-6 { padding-bottom: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-3xl { font-size: 1.875rem; line-height: 2.25rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.leading-relaxed { line-height: 1.625; }

/* Allarme Globale Moduli */
@keyframes pulseWarning {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,0.7); }
  70% { box-shadow: 0 0 0 15px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
