/* css/style.css */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens / Root Variables --- */
:root {
  /* Colors */
  --bg-primary: #0b0f19;
  --bg-secondary: #131b2e;
  --bg-tertiary: #1e293b;
  --glass-bg: rgba(20, 27, 47, 0.65);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-shadow: rgba(0, 0, 0, 0.4);
  
  --primary: #6366f1; /* Indigo */
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.3);
  --secondary: #06b6d4; /* Cyan */
  --secondary-glow: rgba(6, 182, 212, 0.3);
  
  --accent: #d946ef; /* Magenta */
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #64748b;
  
  --success: #10b981; /* Emerald */
  --success-glow: rgba(16, 185, 129, 0.2);
  --warning: #f59e0b; /* Amber */
  --warning-glow: rgba(245, 158, 11, 0.2);
  --danger: #ef4444; /* Rose */
  --danger-glow: rgba(239, 68, 68, 0.2);
  --info: #3b82f6; /* Blue */
  
  /* Fonts */
  --font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
  
  /* Radii */
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-full: 9999px;
  
  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s ease;
}

/* --- Base Reset --- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(217, 70, 239, 0.05) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 {
  font-size: 2.25rem;
  background: linear-gradient(135deg, #ffffff 40%, var(--text-muted) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
}

p {
  color: var(--text-muted);
}

/* --- Glassmorphism Card --- */
.card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 32px 0 var(--glass-shadow);
  border-radius: var(--radius-lg);
  padding: 2rem;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(99, 102, 241, 0.15);
}

/* --- Buttons --- */
.btn {
  font-family: var(--font-family);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--text-muted);
}

.btn-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #b5179e 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(217, 70, 239, 0.3);
}

.btn-accent:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(217, 70, 239, 0.5);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
  color: white;
  box-shadow: 0 4px 15px var(--danger-glow);
}

.btn-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn:active {
  transform: scale(0.98);
}

/* --- Input Fields --- */
.input-group {
  margin-bottom: 1.25rem;
  position: relative;
}

.input-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.input-field {
  width: 100%;
  padding: 0.85rem 1.2rem;
  font-family: var(--font-family);
  font-size: 1rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.input-field:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(15, 23, 42, 0.85);
}

.input-field::placeholder {
  color: var(--text-dark);
}

select.input-field {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1.2rem center;
  background-size: 1.2rem;
  padding-right: 2.5rem;
}

/* --- Layouts & Navigation --- */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 2rem;
  background: rgba(11, 15, 25, 0.7);
  backdrop-filter: blur(15px);
  border-bottom: 1px solid var(--glass-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-size: 1.5rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.nav-brand svg {
  flex-shrink: 0;
}

.nav-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  gap: 0;
}

.nav-brand-company {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, #ffffff 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-brand-suite {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dark);
  -webkit-text-fill-color: var(--text-dark);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.85rem;
  font-weight: 600;
  color: #c7d2fe;
}

.user-badge .role-tag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.4rem;
  background: var(--primary);
  color: white;
  border-radius: 4px;
}

.container {
  max-width: 1300px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

/* ─── Hamburger Nav Button ───────────────────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 18px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  gap: 5px;
  position: relative;
  z-index: 250;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-main);
  border-radius: 2px;
  transition: all var(--transition-normal);
  transform-origin: left center;
}

.nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(0px, -1px); }
.nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(0px, 1px); }


/* --- Auth Page Style --- */
.auth-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 80px);
  padding: 2rem;
}

.auth-card {
  width: 100%;
  max-width: 480px;
}

.auth-tabs {
  display: flex;
  margin-bottom: 2rem;
  border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.auth-tab {
  flex: 1;
  text-align: center;
  padding: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all var(--transition-fast);
}

.auth-tab.active {
  color: var(--text-main);
  border-color: var(--primary);
}

/* --- Widgets & Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
}

.stat-value.success { color: var(--success); }
.stat-value.danger { color: var(--danger); }
.stat-value.warning { color: var(--warning); }
.stat-value.info { color: var(--secondary); }

.stat-footer {
  font-size: 0.8rem;
  color: var(--text-dark);
}

/* --- Timesheet Dashboard Layout --- */
.timesheet-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 1024px) {
  .timesheet-layout {
    grid-template-columns: 3fr 1fr;
  }
}

/* Timesheet Month Navigator */
.month-selector {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  background: rgba(255,255,255,0.02);
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}

.month-label {
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: capitalize;
}

/* Day list table / Grid */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.4);
}

.timesheet-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.timesheet-table th, .timesheet-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.timesheet-table th {
  background: rgba(30, 41, 59, 0.5);
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.timesheet-table tr {
  transition: background-color var(--transition-fast);
}

.timesheet-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.timesheet-table tr.weekend {
  background: rgba(255, 255, 255, 0.015);
}

.timesheet-table tr.weekend td {
  color: var(--text-dark);
}

/* Day Badges / Types */
.day-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  text-transform: uppercase;
}

.day-badge.work { background: rgba(99,102,241,0.15); color: #818cf8; }
.day-badge.ferie { background: rgba(6,182,212,0.15); color: #22d3ee; }
.day-badge.permesso { background: rgba(217,70,239,0.15); color: #f472b6; }
.day-badge.malattia { background: rgba(245,158,11,0.15); color: #fbbf24; }
.day-badge.festivo { background: rgba(16,185,129,0.15); color: #34d399; }
.day-badge.chiusura { background: rgba(239,68,68,0.15); color: #f87171; }

.delta-badge {
  font-weight: 700;
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.delta-badge.positive { color: var(--success); }
.delta-badge.negative { color: var(--danger); }
.delta-badge.zero { color: var(--text-dark); }

/* --- Modals --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(7, 10, 19, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  width: 100%;
  max-width: 500px;
  background: var(--bg-secondary);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  transform: translateY(20px);
  transition: transform var(--transition-normal);
}

.modal-overlay.open .modal-content {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.modal-close:hover {
  color: var(--text-main);
}

/* --- Weekly Plan Manager UI --- */
.plan-days-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.plan-day-box {
  background: rgba(15,23,42,0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.plan-day-name {
  font-weight: 700;
  text-transform: capitalize;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

/* Schedule Weeks Calendar */
.schedule-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 400px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.schedule-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

/* --- Admin Panel --- */
.employee-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem;
  border-bottom: 1px solid var(--glass-border);
}

.employee-info h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.employee-info p {
  font-size: 0.85rem;
}

/* --- Notifications & Toast --- */
.notification {
  padding: 1rem 1.5rem;
  border-radius: var(--radius-md);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 16px rgba(0,0,0,0.25);
  transform: translateX(100%);
  animation: slide-in 0.3s forwards cubic-bezier(0.175, 0.885, 0.32, 1.275);
  border-left: 5px solid transparent;
  background: var(--bg-secondary);
}

.notification.info { border-color: var(--info); background: rgba(59, 130, 246, 0.95); }
.notification.success { border-color: var(--success); background: rgba(16, 185, 129, 0.95); }
.notification.warning { border-color: var(--warning); background: rgba(245, 158, 11, 0.95); color: #0b0f19; }
.notification.danger { border-color: var(--danger); background: rgba(239, 68, 68, 0.95); }

.notification.fade-out {
  animation: fade-out 0.5s forwards ease-in;
}

@keyframes slide-in {
  to { transform: translateX(0); }
}

@keyframes fade-out {
  to { opacity: 0; transform: translateY(10px); }
}

/* Helper utility styles */
.text-center { text-align: center; }
.mt-2 { margin-top: 1rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 1rem; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Config setup warning box */
.warning-box {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid var(--warning);
  color: #fcd34d;
  padding: 1rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.warning-box code {
  background: rgba(0,0,0,0.3);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: monospace;
}

/* ─── PORTALE MODULI ─────────────────────────────────────────────────────── */

.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.module-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.75rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--text-main);
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  animation: fadeSlideUp 0.4s both;
}

.module-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--mod-gradient);
  opacity: 0;
  transition: opacity var(--transition-normal);
  border-radius: inherit;
}

.module-card:hover {
  transform: translateY(-4px);
  border-color: transparent;
  box-shadow: 0 16px 48px var(--mod-glow, rgba(99,102,241,0.3));
}

.module-card:hover::before { opacity: 0.08; }

.module-card-icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}

.module-card-body {
  flex: 1;
  position: relative;
  z-index: 1;
}

.module-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
  color: var(--text-main);
}

.module-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.module-card-arrow {
  color: var(--text-dark);
  transition: transform var(--transition-fast), color var(--transition-fast);
  position: relative;
  z-index: 1;
}

.module-card:hover .module-card-arrow {
  color: var(--text-main);
  transform: translateX(4px);
}

.module-card-skeleton {
  height: 120px;
  background: linear-gradient(90deg, var(--glass-bg) 25%, rgba(255,255,255,0.04) 50%, var(--glass-bg) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
}

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ─── ADMIN TABS ─────────────────────────────────────────────────────────── */

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 2px solid var(--glass-border);
  padding-bottom: 0;
  margin-bottom: 2rem;
}

.admin-tab {
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.admin-tab:hover { color: var(--text-main); background: rgba(255,255,255,0.03); }

.admin-tab.active {
  color: var(--text-main);
  border-bottom-color: var(--primary);
}

/* ─── TABELLA PERMESSI MODULI ────────────────────────────────────────────── */

.modules-perm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.modules-perm-table th,
.modules-perm-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--glass-border);
  text-align: left;
  vertical-align: middle;
}

.modules-perm-table th {
  background: rgba(30,41,59,0.5);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.modules-perm-table tr:hover { background: rgba(255,255,255,0.015); }

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle-switch input { display: none; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 24px;
  transition: background var(--transition-fast);
  border: 1px solid var(--glass-border);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 2px;
  background: var(--text-dark);
  border-radius: 50%;
  transition: transform var(--transition-fast), background var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
  background: rgba(16,185,129,0.25);
  border-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(19px);
  background: var(--success);
}

/* ─── CEDOLINI MODULE ────────────────────────────────────────────────────── */

.suffissi-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.suffisso-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.suffisso-item:hover { background: rgba(99,102,241,0.15); border-color: var(--primary); }

.suffisso-item input[type="checkbox"] {
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
  cursor: pointer;
}

/* Log container */
.log-container {
  background: rgba(7,10,19,0.8);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: 320px;
  overflow-y: auto;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.82rem;
  line-height: 1.8;
}

.log-line { padding: 0.1rem 0; }
.log-ok    { color: var(--success); }
.log-errore { color: var(--danger); }
.log-skip  { color: var(--warning); }
.log-info  { color: var(--text-muted); }

/* Cedolino item nella lista */
.cedolino-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.cedolino-item:hover { background: rgba(255,255,255,0.04); }

.upload-dropzone.dragover {
  border-color: var(--primary) !important;
  background: rgba(99, 102, 241, 0.08) !important;
}

.sorgente-file-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

.sorgente-file-row button {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-weight: bold;
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤ 1024px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .container {
    margin: 1.5rem auto;
    padding: 0 1rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .navbar {
    padding: 1rem 1.25rem;
  }

  /* Su tablet la sidebar va sotto, non a lato */
  .timesheet-layout {
    grid-template-columns: 1fr;
  }
}


/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤ 768px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ─── Navbar ─────────────────────────────────────────────────────────── */
  .navbar {
    padding: 0.85rem 1rem;
    position: sticky;
    top: 0;
    z-index: 200;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(7, 10, 19, 0.98); /* Rich, dark, opaque background to cover what's underneath */
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.75rem;
    z-index: 240; /* Sits underneath nav-toggle (250) but above everything else */
    padding: 2rem;
    
    /* Smooth CSS fade and slide down transition */
    display: flex;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
  }

  .nav-links.mobile-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-links .nav-link {
    font-size: 1.25rem;
    font-weight: 600;
    padding: 0.85rem 2rem;
    width: 100%;
    text-align: center;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.03);
    background: rgba(255, 255, 255, 0.01);
  }

  .nav-links .nav-link:hover,
  .nav-links .nav-link.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.2);
    color: #c7d2fe;
  }

  .nav-links .user-badge {
    order: -1;
    margin-bottom: 0.75rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
  }

  .nav-links .btn {
    width: 100%;
    justify-content: center;
    padding: 0.85rem 1.5rem;
  }

  /* No longer need nav-mobile-close as nav-toggle sits on top and toggles perfectly */
  .nav-mobile-close {
    display: none !important;
  }

  /* ─── Container ──────────────────────────────────────────────────────── */
  .container {
    margin: 1rem auto;
    padding: 0 0.75rem;
  }

  /* ─── Stats grid: 2 col on phone ──────────────────────────────────────── */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .stat-card {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  /* ─── Cards ───────────────────────────────────────────────────────────── */
  .card {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }

  /* ─── Month selector ──────────────────────────────────────────────────── */
  .month-selector {
    padding: 0.5rem 0.75rem;
    margin-bottom: 1rem;
  }

  .month-label {
    font-size: 1rem;
  }

  .month-selector .btn {
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
  }

  /* ─── Action buttons bar (PDF, Email) ─────────────────────────────────── */
  .actions-bar {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .actions-bar .btn {
    flex: 1;
    font-size: 0.85rem;
    padding: 0.7rem 0.5rem;
  }

  /* ─── Timesheet table → Card-based list on mobile ─────────────────────── */
  .table-container {
    border: none;
    background: transparent;
    border-radius: 0;
    overflow-x: visible;
  }

  .timesheet-table thead {
    display: none; /* Nascondi gli header su mobile */
  }

  .timesheet-table,
  .timesheet-table tbody,
  .timesheet-table tr,
  .timesheet-table td {
    display: block;
    width: 100%;
  }

  .timesheet-table tr {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: 0.6rem;
    padding: 0.85rem 1rem;
    position: relative;
    transition: box-shadow var(--transition-fast);
  }

  .timesheet-table tr:hover {
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
    background: var(--glass-bg);
  }

  .timesheet-table tr.weekend {
    border-left: 3px solid rgba(99, 102, 241, 0.4);
  }

  /* Data-label layout: etichetta a sinistra, valore a destra */
  .timesheet-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.3rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    font-size: 0.88rem;
    min-height: 2rem;
  }

  .timesheet-table td:last-child {
    border-bottom: none;
    padding-top: 0.5rem;
    justify-content: flex-end;
  }

  /* Prima cella = giorno: più grande e in evidenza */
  .timesheet-table td:first-child {
    font-size: 1rem;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    padding-bottom: 0.6rem;
    margin-bottom: 0.15rem;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .timesheet-table td::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-dark);
    flex-shrink: 0;
    margin-right: 0.5rem;
  }

  .timesheet-table td:first-child::before { content: none; }
  .timesheet-table td:last-child::before  { content: none; }

  /* ─── Modal → Bottom-sheet su mobile ──────────────────────────────────── */
  .modal-overlay {
    align-items: flex-end;
  }

  .modal-content {
    max-width: 100%;
    width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.5rem 1.25rem;
    max-height: 92vh;
    overflow-y: auto;
    transform: translateY(100%);
  }

  .modal-overlay.open .modal-content {
    transform: translateY(0);
  }

  /* Handle bar sul modal */
  .modal-content::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 1.25rem;
  }

  /* Input touch-friendly */
  .input-field {
    padding: 0.9rem 1rem;
    font-size: 1rem; /* evita zoom automatico su iOS */
    min-height: 44px;
  }

  select.input-field {
    min-height: 44px;
  }

  /* Grid 2 colonne nel modal → 1 colonna su telefono */
  #work-time-fields > div[style*="grid-template-columns"] {
    display: flex !important;
    flex-direction: column !important;
    gap: 0 !important;
  }

  /* Bottoni del modal a piena larghezza */
  .modal-content .flex.gap-2 {
    flex-direction: column;
    gap: 0.6rem;
  }

  .modal-content .flex.gap-2 .btn {
    width: 100%;
  }

  /* ─── Teacher interval rows ───────────────────────────────────────────── */
  .teacher-interval-row {
    grid-template-columns: 1fr 1fr !important;
    gap: 0.4rem !important;
  }

  .teacher-interval-row > div:nth-child(3),
  .teacher-interval-row > div:nth-child(4) {
    grid-column: span 2;
  }

  .teacher-interval-row > div:nth-child(5) {
    grid-column: span 2;
    text-align: right;
  }

  /* ─── Admin panel ─────────────────────────────────────────────────────── */
  .employee-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .employee-card > div:last-child {
    display: flex;
    gap: 0.5rem;
    width: 100%;
  }

  .employee-card > div:last-child .btn {
    flex: 1;
  }

  /* ─── Admin tabs: scrollabile orizzontalmente ─────────────────────────── */
  .admin-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    gap: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .admin-tabs::-webkit-scrollbar { display: none; }

  .admin-tab {
    white-space: nowrap;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
  }

  /* Sidebar / aside: diventa riga orizzontale */
  .timesheet-layout > aside {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 0.75rem;
  }

  .timesheet-layout > aside > .card {
    flex: 1;
    min-width: 200px;
  }

  /* Legenda: due colonne su mobile */
  .timesheet-layout > aside .flex.flex-col.gap-2 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.4rem !important;
  }

  /* Modules grid: 1 colonna */
  .modules-grid {
    grid-template-columns: 1fr;
  }

  /* Notifiche: full-width in basso */
  #notification-container {
    left: 1rem !important;
    right: 1rem !important;
    width: auto !important;
  }

  h1 { font-size: 1.6rem; }

  .warning-box {
    flex-direction: column !important;
    gap: 0.75rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE — Smartphone compatto (≤ 480px)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .stat-value {
    font-size: 1.35rem;
  }

  .stat-title {
    font-size: 0.75rem;
  }

  .month-selector .btn span {
    display: none; /* Nasconde testo, mostra solo freccia */
  }
}

/* Su desktop, l'inline badge nella prima cella è nascosto (c'è già la colonna Tipo) */
@media (min-width: 769px) {
  .timesheet-table td:first-child .day-badge { display: none; }
}

/* Su mobile, la cella Tipo (seconda colonna) è nascosta perché il badge è già nella prima cella */
@media (max-width: 768px) {
  .timesheet-table td[data-label="Tipo"] { display: none; }
}

/* Pulsanti navigazione modal disabilitati */
#modal-nav-prev:disabled,
#modal-nav-next:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}
