/* CSS Variables */
:root {
  --primary: #6d28d9;
  --accent: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;

  --bg: #0b0f19;
  --text: #ffffff;

  --card: #121a2a;
  --muted: rgba(255, 255, 255, 0.72);
  --border: rgba(255, 255, 255, 0.12);
  --header-bg: color-mix(in srgb, var(--bg) 86%, transparent);

  --radius: 16px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35);

  --space: 20px;
  --max: 980px;

  /* Animations */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light Theme: Blue */
[data-theme="light-blue"] {
  --primary: #007bff;
  --accent: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;

  --bg: #f8f9fa;
  --text: #212529;

  --card: #ffffff;
  --muted: #6c757d;
  --border: #dee2e6;

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Light Theme: Rose */
[data-theme="light-rose"] {
  --primary: #e91e63;
  --accent: #9c27b0;
  --warning: #ff9800;
  --danger: #f44336;

  --bg: #fefefe;
  --text: #212529;

  --card: #fce4ec;
  --muted: #ad1457;
  --border: #f8bbd9;

  --shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Global Styles */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

/* Layout */
.container {
  width: 100%;
  max-width: 980px; /* Larghezza fissa come prima */
  margin: 0 auto;
  padding: var(--space);
}

/* Desktop: mantieni larghezza fissa */
@media (min-width: 1200px) {
  .container {
    max-width: 980px;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 8px;
  }
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
  color: var(--text);
}

/* Header text color with automatic contrast */
.topbar {
  --header-text-color: white;
}

@media (prefers-color-scheme: light) {
  .topbar {
    --header-text-color: black;
  }
}

/* Apply header text color to header elements */
.topbar .brand-name,
.topbar .badge {
  color: var(--header-text-color) !important;
}

@media (max-width: 640px) {
  .brand {
    gap: 10px;
    padding: 10px 0;
  }

  .brand-logo {
    width: 36px;
    height: 36px;
  }

  .brand-name {
    font-size: 16px;
  }

  .badge {
    font-size: 11px;
    padding: 6px 10px;
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border);
}

.brand-name {
  font-weight: 800;
  letter-spacing: 0.2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted);
  font-size: 13px;
}

/* Cards */
.card {
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

@media (max-width: 640px) {
  .card {
    padding: 16px;
    border-radius: 12px;
  }
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

/* Grid */
.grid {
  display: grid;
  gap: 16px;
}

@media (max-width: 860px) {
  .grid {
    gap: 12px;
  }

  .grid.cols-2 {
    grid-template-columns: 1fr;
  }

  /* Hide sidebar summary on mobile */
  .grid.cols-2 > aside {
    display: none;
  }
}

@media (min-width: 861px) {
  .grid.cols-2 {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

/* Buttons */
.btn {
  height: 48px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all var(--transition-fast);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}

@media (max-width: 640px) {
  .btn {
    height: 44px;
    min-height: 44px;
    padding: 0 16px;
    font-size: 14px;
    gap: 8px;
  }

  .row {
    gap: 10px;
  }

  .row > * {
    flex: 1 1 120px;
  }

  /* Form elements mobile optimization */
  input,
  select,
  textarea {
    padding: 10px 10px;
    font-size: 14px;
  }

  label {
    font-size: 12px;
    margin: 8px 0 4px;
  }

  .h1 {
    font-size: 18px;
  }

  .p {
    font-size: 13px;
  }
}

.btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transform: translate(-50%, -50%);
  transition: width var(--transition-slow), height var(--transition-slow);
}

.btn:active::before {
  width: 300px;
  height: 300px;
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 85%, black) 100%);
  border-color: color-mix(in srgb, var(--primary) 55%, white);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
}

.btn.primary:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(109, 40, 217, 0.4);
  transform: translateY(-2px);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.2);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.08);
}

.btn.danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

.btn.success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

.btn.small {
  height: 36px;
  min-height: 36px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
}

/* Form Elements */
input,
select,
textarea {
  width: 100%;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

label {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin: 10px 0 6px;
}

.row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.row > * {
  flex: 1 1 140px;
}

.hidden {
  display: none !important;
}

/* Stepper */
.stepper {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0 18px;
}

.step-dot {
  height: 10px;
  width: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid var(--border);
}

.step-dot.active {
  background: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 55%, white);
}

/* Typography */
.h1 {
  font-size: 22px;
  margin: 0 0 8px;
}

.p {
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.45;
}

/* Service Grid */
.service-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
}

@media (max-width: 640px) {
  .service-card {
    flex-direction: column;
    padding: 12px;
    gap: 12px;
  }

  .service-thumb {
    width: 100%;
    height: 160px;
    align-self: center;
  }

  .service-meta {
    text-align: center;
  }

  .price {
    align-self: center;
    margin-top: 8px;
  }
}

@media (min-width: 641px) and (max-width: 860px) {
  .service-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 861px) {
  .service-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.service-card {
  display: flex;
  gap: 16px;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 0%, rgba(109, 40, 217, 0.05) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.service-card:hover::before {
  opacity: 1;
}

.service-card:hover {
  transform: translateY(-4px) scale(1.02);
  border-color: color-mix(in srgb, var(--primary) 55%, white);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(109, 40, 217, 0.1);
}

.service-card:active {
  transform: translateY(-2px) scale(1.01);
}

.service-card.selected {
  border-color: color-mix(in srgb, var(--primary) 65%, white);
  background: color-mix(in srgb, var(--primary) 16%, rgba(255, 255, 255, 0.04));
  box-shadow: 0 8px 24px rgba(109, 40, 217, 0.3), 0 0 0 2px rgba(109, 40, 217, 0.2);
  transform: translateY(-2px);
}

.service-thumb {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}

.service-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.service-name {
  font-weight: 800;
  font-size: 17px;
  margin: 0 0 6px;
  line-height: 1.3;
}

.service-sub {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.price {
  font-weight: 800;
  font-size: 18px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  height: fit-content;
  align-self: flex-start;
  margin-top: auto;
}

/* Slot Grid */
.slot-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 420px) and (max-width: 640px) {
  .slot-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .slot {
    height: 44px;
    font-size: 14px;
  }
}

@media (min-width: 641px) and (max-width: 860px) {
  .slot-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 861px) {
  .slot-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.slot {
  height: 48px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.slot::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.slot:hover:not(.disabled)::before {
  opacity: 1;
}

.slot:hover:not(.disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-color: var(--primary);
}

.slot.selected {
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 24%, rgba(255, 255, 255, 0.06)),
    color-mix(in srgb, var(--primary) 18%, rgba(255, 255, 255, 0.04))
  );
  border-color: color-mix(in srgb, var(--primary) 70%, white);
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.3);
  transform: translateY(-2px);
}

.slot.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  background: rgba(100, 100, 100, 0.05);
}

.slot:active:not(.disabled) {
  transform: translateY(0) scale(0.98);
}

/* Staff Selection Grid */
.staff-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .staff-grid {
    gap: 10px;
  }

  .staff-card {
    padding: 12px;
  }

  .staff-name {
    font-size: 14px;
  }

  .staff-skills {
    font-size: 11px;
  }
}

@media (min-width: 641px) and (max-width: 860px) {
  .staff-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 861px) {
  .staff-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.staff-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.08s ease, border-color 0.15s ease, background 0.15s ease;
  position: relative;
}

.staff-card:active {
  transform: translateY(1px);
}

.staff-card.selected {
  border-color: color-mix(in srgb, var(--primary) 55%, white);
  background: color-mix(in srgb, var(--primary) 16%, rgba(255, 255, 255, 0.04));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 30%, transparent);
}

.staff-color {
  width: 12px;
  height: 48px;
  border-radius: 6px;
  background: #999;
  border: 1px solid var(--border);
}

.staff-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.staff-name {
  font-weight: 900;
  font-size: 15px;
  margin: 0;
}

.staff-skills {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
}

.staff-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 900;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid color-mix(in srgb, var(--primary) 60%, white);
}

hr.sep {
  border: none;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 32px;
  padding: 24px 0;
}

.hero-title {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 12px;
  background: linear-gradient(135deg, var(--text) 0%, color-mix(in srgb, var(--text) 70%, var(--bg)) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--muted);
  margin: 0;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

@media (max-width: 640px) {
  .hero-title {
    font-size: 24px;
  }

  .hero-subtitle {
    font-size: 14px;
  }
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .nav-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
  }

  .nav-tabs .tab-btn {
    padding: 12px 8px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    border-radius: 8px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

.tab-btn {
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  transition: all var(--transition-fast);
}

.tab-btn.active {
  background: color-mix(in srgb, var(--primary) 18%, rgba(255, 255, 255, 0.06));
  border-color: color-mix(in srgb, var(--primary) 55%, white);
}

@media (max-width: 640px) {
  .tab-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
  }
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

/* 😊 MOBILE BOTTOM NAVIGATION */
.mobile-bottom-nav {
  display: none; /* Nascosto su desktop */
}

@media (max-width: 640px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: color-mix(in srgb, var(--card) 95%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    z-index: 100;
    padding: 8px 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
  }

  .mobile-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: var(--muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    min-height: 56px;
    padding: 4px 8px;
  }

  .mobile-tab-btn:active {
    transform: scale(0.95);
  }

  .mobile-tab-icon {
    width: 24px;
    height: 24px;
    stroke-width: 2;
    transition: all var(--transition-fast);
  }

  .mobile-tab-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: capitalize;
  }

  .mobile-tab-btn.active {
    color: var(--primary);
  }

  .mobile-tab-btn.active .mobile-tab-icon {
    stroke-width: 2.5;
    transform: scale(1.1);
  }

  .mobile-tab-btn.active .mobile-tab-label {
    font-weight: 700;
  }

  /* Badge notification per le prenotazioni nella bottom nav */
  .mobile-badge-count {
    position: absolute;
    top: 6px;
    right: 50%;
    transform: translateX(16px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--danger);
    color: white;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--card);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  }

  .mobile-badge-count.hidden {
    display: none;
  }
}

/* Mostra solo su mobile */
.mobile-only {
  display: none !important;
}

@media (max-width: 640px) {
  .mobile-only {
    display: flex !important;
  }

  .desktop-only {
    display: none !important;
  }
}

/* Responsive Table Styles */
.table-container {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 640px) {
  .table-container {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    /* Remove horizontal scroll, force responsive behavior */
    overflow-x: visible;
  }

  .table {
    font-size: 13px;
    border: none;
    width: 100%;
    min-width: auto;
  }

  .table thead {
    display: none; /* Hide table headers on mobile */
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.04);
  }

  .table td {
    border: none;
    padding: 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
  }

  .table td:before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .table td:last-child {
    border-bottom: none;
    padding-bottom: 0;
  }

  /* Hide less important columns on mobile */
  .table .hide-mobile {
    display: none !important;
  }

  /* Make action buttons full width on mobile */
  .table .mobile-full {
    width: 100%;
    margin-top: 8px;
  }
}

.table th,
.table td {
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.04);
}

.table tr:last-child td {
  border-bottom: none;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  padding: 14px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(18, 26, 42, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: var(--text);
  z-index: 9999;
  max-width: calc(100% - 48px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-weight: 600;
  font-size: 14px;
  animation: toastSlideIn var(--transition-slow) forwards,
             toastSlideOut var(--transition-slow) 2.3s forwards;
}

@keyframes toastSlideIn {
  to {
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes toastSlideOut {
  to {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
  }
}

/* Calendar Grid Styles */
.calendar-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 16px;
  min-height: 400px;
}

@media (max-width: 640px) {
  .calendar-grid {
    overflow-x: auto;
    min-height: 300px;
    -webkit-overflow-scrolling: touch;
  }
}

.calendar-header {
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  font-weight: 900;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.calendar-time-col {
  background: rgba(255, 255, 255, 0.02);
  padding: 0 4px;
  font-size: 10px;
  color: var(--muted);
  text-align: center;
  border-right: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.calendar-staff-col {
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  height: 100%;
}

.booking-slot {
  position: absolute;
  left: 4px;
  right: 4px;
  padding: 0 4px;
  font-size: 10px;
  line-height: 20px;
  border-left-width: 2px;
  border-left-style: solid;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(2px);
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 4px;
}

.booking-slot .slot-service,
.booking-slot .slot-customer {
  display: inline-block;
  margin: 0 4px;
}

.booking-slot:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.22);
}

.booking-slot .slot-time {
  font-weight: 900;
}

.booking-slot .slot-customer {
  color: var(--muted);
  font-size: 10px;
}

.booking-slot .slot-service {
  font-weight: 700;
  font-size: 10px;
}

.calendar-time-col {
  font-size: 10px;
  color: var(--muted);
  border-bottom: 1px dotted rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 4px;
  background: rgba(255, 255, 255, 0.02);
  padding: 8px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.calendar-staff-col {
  border-bottom: 1px dotted rgba(255, 255, 255, 0.05);
  border-right: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  position: relative;
  height: 100%;
}

.calendar-empty {
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  padding: 40px;
  color: var(--muted);
  border-radius: var(--radius);
  margin-top: 16px;
}

/* Sticky Summary Box */
.sticky-summary {
  position: fixed;
  top: 70px;
  right: 16px;
  background: color-mix(in srgb, var(--card) 95%, transparent);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  z-index: 100;
  min-width: 220px;
  max-width: 280px;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

.sticky-summary > div {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.3;
}

.sticky-summary strong {
  color: var(--muted);
  font-weight: 700;
}

@media (max-width: 860px) {
  .sticky-summary {
    top: auto;
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    transform: translateY(10px);
  }
}

/* Badge Notifications */
.tab-btn {
  position: relative;
}

.badge-count {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: bold;
  height: 18px;
  min-width: 18px;
  padding: 0 4px;
  border-radius: 99px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg);
}

/* Monthly View */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 16px;
}

@media (max-width: 640px) {
  .month-grid {
    gap: 4px;
  }

  .month-cell {
    min-height: 60px;
    padding: 6px;
    border-radius: 8px;
  }

  .month-cell-date {
    font-size: 12px !important;
    margin-bottom: 2px !important;
  }
}

@media (max-width: 400px) {
  .month-grid {
    gap: 2px;
  }

  .month-cell {
    min-height: 48px;
    padding: 4px;
    border-radius: 6px;
  }

  .month-cell-date {
    font-size: 11px !important;
    margin-bottom: 2px !important;
  }
}

.month-cell {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 80px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.month-cell:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
}

.month-cell.today {
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.06);
}

.month-cell.has-bookings {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.3);
}

.month-cell-date {
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 4px;
}

.month-cell-dots {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
}

.booking-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

/* Month Navigation Header */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 16px;
  padding: 0 8px;
}

/* Opzionale: Assicura che le frecce siano facili da cliccare */
.month-nav button {
  min-width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

@media (max-width: 640px) {
  .month-nav {
    margin-bottom: 12px;
  }

  .month-nav h3,
  .month-nav .h1 {
    font-size: 16px !important;
  }

  .month-nav .btn {
    min-width: 44px;
    padding: 0 12px;
  }
}

/* Pending Request Card */
.pending-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
}

.pending-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pending-actions {
  display: flex;
  gap: 8px;
}

/* Booking slots with different states */
.booking-slot.pending {
  background: repeating-linear-gradient(
    45deg,
    rgba(255, 193, 7, 0.2),
    rgba(255, 193, 7, 0.2) 10px,
    rgba(255, 193, 7, 0.1) 10px,
    rgba(255, 193, 7, 0.1) 20px
  );
  border-left-color: #fbbf24 !important;
}

.booking-slot.confirmed {
  background: rgba(34, 197, 94, 0.15);
  border-left-color: #22c55e !important;
}

.booking-slot.cancelled {
  background: rgba(148, 163, 184, 0.15);
  border-left-color: #94a3b8 !important;
  opacity: 0.5;
}

.booking-slot.hidden-by-filter {
  display: none !important;
}

/* Success button style */
.btn.success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

/* Toggle Switch Style */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}

.toggle-label {
  font-weight: 500;
  font-size: 14px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-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: 0.3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 2px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.btn.small {
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  font-size: 14px;
}

/* Services and Team Sections Mobile Optimizations */
@media (max-width: 640px) {
  /* Stack form fields vertically on mobile for better usability */
  #tab-services .row > div,
  #tab-team .row > div {
    flex: 1 1 100%; /* Full width on mobile */
    margin-bottom: 12px;
  }

  /* Better spacing for form sections */
  #tab-services .card:first-child,
  #tab-team .card:first-child {
    padding-bottom: 20px;
    margin-bottom: 16px;
  }

  /* Larger touch targets for table buttons */
  #tab-services .mobile-full,
  #tab-team .mobile-full {
    min-height: 48px;
    padding: 12px 16px;
    font-size: 14px;
  }

  /* Improve file input appearance */
  #tab-services #svcImage,
  #tab-team input[type="file"] {
    padding: 12px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    margin-top: 6px;
  }

  /* Better spacing for form labels */
  #tab-services label,
  #tab-team label {
    margin-top: 8px;
    margin-bottom: 4px;
  }

  /* Improve color input on mobile */
  #tab-team #stfColor {
    width: 60px;
    height: 48px;
    border-radius: 8px;
    border: 2px solid var(--border);
  }
}

/* Config Section Mobile Optimizations */
@media (max-width: 640px) {
  /* Config section cards spacing */
  #tab-config .card {
    margin-bottom: 12px;
  }

  /* Weekly schedule table - make it responsive like other tables */
  #tab-config .table-container {
    overflow-x: visible;
  }

  #tab-config .table {
    font-size: 13px;
    border: none;
    width: 100%;
    min-width: auto;
  }

  #tab-config .table thead {
    display: none;
  }

  #tab-config .table,
  #tab-config .table tbody,
  #tab-config .table tr,
  #tab-config .table td {
    display: block;
    width: 100%;
  }

  #tab-config .table tr {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
  }

  #tab-config .table td {
    border: none;
    padding: 6px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
  }

  #tab-config .table td:before {
    content: attr(data-label) ": ";
    font-weight: 700;
    color: var(--muted);
    flex: 0 0 auto;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Enhanced Theme section */
  .color-theme-grid {
    display: grid;
    gap: 20px;
  }

  .color-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    transition: all var(--transition-fast);
  }

  .color-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
  }

  .color-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
  }

  .color-icon {
    font-size: 18px;
  }

  .color-title {
    font-weight: 700;
    font-size: 15px;
    color: var(--text);
  }

  .color-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
  }

  .color-picker-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .color-picker-wrapper input[type="color"] {
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform var(--transition-fast);
  }

  .color-picker-wrapper input[type="color"]:hover {
    transform: scale(1.05);
  }

  .color-preview {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid var(--border);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }

  .color-value {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 10px;
    border-radius: 6px;
    min-width: 80px;
    text-align: center;
  }

  .color-description {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
  }

  /* Mobile optimizations for theme section */
  @media (max-width: 640px) {
    .color-theme-grid {
      gap: 16px;
    }

    .color-item {
      padding: 14px;
    }

    .color-controls {
      flex-direction: column;
      align-items: flex-start;
      gap: 10px;
    }

    .color-picker-wrapper {
      align-self: center;
    }

    .color-picker-wrapper input[type="color"] {
      width: 50px;
      height: 50px;
    }

    .color-preview {
      width: 50px;
      height: 50px;
    }

    .color-value {
      font-size: 13px;
      padding: 4px 8px;
      min-width: 70px;
    }

    .theme-notice {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-top: 16px;
      padding: 12px;
      background: rgba(109, 40, 217, 0.1);
      border: 1px solid rgba(109, 40, 217, 0.2);
      border-radius: 8px;
      font-size: 13px;
      color: var(--text);
    }

    .theme-icon {
      font-size: 16px;
    }

    /* Mobile optimizations for theme section */
    @media (max-width: 640px) {
      .color-theme-grid {
        gap: 16px;
      }

      .color-item {
        padding: 14px;
      }

      .color-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
      }

      .color-picker-wrapper {
        align-self: center;
      }

      .color-picker-wrapper input[type="color"] {
        width: 50px;
        height: 50px;
      }

      .color-preview {
        width: 50px;
        height: 50px;
      }

      .color-value {
        font-size: 13px;
        padding: 4px 8px;
        min-width: 70px;
      }

      .theme-notice {
        padding: 10px;
        font-size: 12px;
      }
    }
  }

  /* Brand section - stack elements */
  #tab-config label[for="cfgBrandName"],
  #tab-config label[for="cfgLogo"],
  #tab-config label[for="cfgLogoFile"] {
    margin-top: 8px;
  }

  /* Exception form - compact */
  #tab-config .row:has(#cfgExceptionDate) {
    gap: 6px;
  }

  #tab-config .row:has(#cfgExceptionDate) input,
  #tab-config .row:has(#cfgExceptionDate) select {
    font-size: 13px;
    padding: 8px 8px;
  }

  /* Client visibility toggles - better spacing */
  #tab-config .toggle-row {
    margin-bottom: 6px;
  }

  #tab-config .toggle-row .toggle-label {
    font-size: 13px;
  }
}

/* Theme Preset Cards */
.theme-preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

@media (max-width: 640px) {
  .theme-preset-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
}

.theme-preset-card {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
  background: rgba(255, 255, 255, 0.02);
  text-align: center;
  user-select: none;
}

.theme-preset-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.theme-preset-card.active {
  border-color: var(--primary);
  background: rgba(109, 40, 217, 0.1);
  box-shadow: 0 0 0 2px rgba(109, 40, 217, 0.2);
}

.preset-preview {
  width: 100%;
  height: 60px;
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 640px) {
  .theme-preset-card {
    padding: 10px;
  }

  .preset-preview {
    height: 50px;
  }

  .preset-name {
    font-size: 12px !important;
  }
}

.preset-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

/* Client Calendar with Availability */
.client-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 8px;
  overflow-x: hidden;
}

.client-day-cell {
  aspect-ratio: 1;
  min-height: 60px;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
}

/* Mobile Optimization */
@media (max-width: 640px) {
  .client-month-grid {
    gap: 2px;
  }

  .client-day-cell {
    min-height: 48px;
    padding: 4px;
    border-radius: 8px;
    border-width: 1.5px;
  }

  .client-day-number {
    font-size: 14px !important;
    margin-bottom: 2px !important;
  }

  .client-day-status {
    font-size: 8px !important;
    letter-spacing: 0.3px !important;
  }

  .client-day-cell.today::after {
    width: 4px;
    height: 4px;
    top: 3px;
    right: 3px;
  }
}

/* Extra small screens - tighten calendar columns */
@media (max-width: 400px) {
  .client-month-grid {
    gap: 0.5px;
  }

  .client-day-cell {
    min-height: 32px;
    padding: 1px;
    border-radius: 4px;
    border-width: 1px;
  }

  .client-day-number {
    font-size: 10px !important;
    margin-bottom: 0px !important;
  }

  .client-day-status {
    font-size: 6px !important;
    letter-spacing: 0.1px !important;
  }

  .client-day-cell.today::after {
    width: 2px;
    height: 2px;
    top: 1px;
    right: 1px;
  }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
  .client-day-cell {
    min-height: 54px;
    padding: 6px;
  }

  .client-day-number {
    font-size: 16px !important;
  }

  .client-day-status {
    font-size: 8.5px !important;
  }
}

.client-day-cell:hover:not(.disabled):not(.past) {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--primary);
  transform: translateY(-2px);
}

.client-day-cell.selected {
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 85%, black) 100%);
  border-color: color-mix(in srgb, var(--primary) 55%, white);
  border-width: 3px;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 30%, transparent), 0 4px 12px rgba(109, 40, 217, 0.4);
  transform: scale(1.05);
  color: white;
}

.client-day-cell.today {
  border-color: var(--primary);
  border-width: 2px;
}

.client-day-cell.today::after {
  content: '';
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}

.client-day-cell.disabled {
  opacity: 0.3;
  cursor: not-allowed;
  background: rgba(100, 100, 100, 0.1);
}

.client-day-cell.past {
  opacity: 0.4;
  cursor: not-allowed;
  background: rgba(100, 100, 100, 0.05);
}

.client-day-cell.has-availability {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.client-day-cell.has-availability:hover {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.5);
}

.client-day-cell.limited-availability {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}

.client-day-cell.limited-availability:hover {
  background: rgba(251, 191, 36, 0.15);
  border-color: rgba(251, 191, 36, 0.5);
}

.client-day-number {
  font-size: 18px;
  font-weight: 800;
  margin-bottom: 4px;
}

.client-day-status {
  font-size: 9px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.5px;
  opacity: 0.8;
}

.client-day-cell.has-availability .client-day-status {
  color: #22c55e;
}

.client-day-cell.limited-availability .client-day-status {
  color: #fbbf24;
}

.client-day-cell.disabled .client-day-status {
  color: #94a3b8;
}

/* Legend */
.calendar-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px solid var(--border);
}

@media (max-width: 640px) {
  .calendar-legend {
    gap: 12px;
    padding: 10px;
    margin-top: 12px;
  }

  .legend-item {
    font-size: 11px;
  }

  .legend-color {
    width: 14px;
    height: 14px;
  }
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.legend-color {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 2px solid;
}

.legend-color.available {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
}

.legend-color.limited {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.3);
}

.legend-color.closed {
  background: rgba(100, 100, 100, 0.1);
  border-color: var(--border);
}

/* Skeleton Loaders */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 0%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 100%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 8px;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }

  100% {
    background-position: -200% 0;
  }
}

.skeleton-slot {
  height: 48px;
  border-radius: 12px;
}

.skeleton-service {
  height: 120px;
  border-radius: 16px;
}



/* Fade In Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

.fade-in {
  animation: fadeIn var(--transition-base) ease-out;
}

/* Drag and Drop Styles */
.drag-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.drag-icon {
  font-size: 14px;
  color: var(--muted);
  transform: rotate(90deg);
  line-height: 1;
}

.draggable-list tr {
  cursor: grab;
  transition: all var(--transition-fast);
}

.draggable-list tr:hover {
  background: rgba(255, 255, 255, 0.06);
}

.draggable-list tr:active {
  cursor: grabbing;
}

.draggable-list tr.dragging {
  opacity: 0.5;
  transform: rotate(5deg);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  background: rgba(109, 40, 217, 0.1);
  border: 2px solid var(--primary);
}

.draggable-list tr.dragging td {
  border-color: var(--primary);
}

/* Mobile drag hint adjustments */
@media (max-width: 640px) {
  .drag-hint {
    font-size: 11px;
  }

  .drag-icon {
    font-size: 12px;
  }
}

/* Loading Screen */
.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

.loading-text {
  font-size: 18px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

@media (max-width: 640px) {
  .loading-content {
    gap: 20px;
  }

  .loading-spinner {
    width: 50px;
    height: 50px;
    border-width: 3px;
  }

  .loading-text {
    font-size: 16px;
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 📊 Dashboard Metriche Avanzate */
.metrics-dashboard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

@media (max-width: 640px) {
  .metrics-dashboard {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
  }

  .metrics-dashboard .metric-card {
    padding: 12px;
  }

  .metrics-dashboard .metric-value {
    font-size: 20px;
  }

  .metrics-dashboard .metric-icon svg {
    width: 20px;
    height: 20px;
  }
}

.metric-card {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: all var(--transition-base);
}

/* Gradienti tematici per ogni metrica */
.metric-bookings {
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.1), rgba(139, 92, 246, 0.05));
}

.metric-revenue {
  background: linear-gradient(135deg, rgba(245, 101, 101, 0.1), rgba(252, 165, 165, 0.05));
}

.metric-time {
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), rgba(56, 189, 248, 0.05));
}

.metric-occupancy {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(74, 222, 128, 0.05));
}

.metric-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.03), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.metric-card:hover::before {
  opacity: 1;
}

.metric-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.metric-icon {
  margin-bottom: 8px;
  opacity: 0.8;
}

.metric-icon svg {
  width: 24px;
  height: 24px;
  color: var(--text);
}

.metric-value {
  font-size: 24px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 4px;
  line-height: 1.1;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
  line-height: 1.2;
}

.metric-trend {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 99px;
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.metric-trend.positive {
  background: rgba(var(--accent), 0.15);
  color: var(--accent);
  border: 1px solid rgba(var(--accent), 0.3);
}

.metric-trend.negative {
  background: rgba(var(--danger), 0.15);
  color: var(--danger);
  border: 1px solid rgba(var(--danger), 0.3);
}

.metric-trend:not(.positive):not(.negative) {
  background: rgba(148, 163, 184, 0.15);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.3);
}

/* Filtri sezione ottimizzata */
.filters-section {
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .filters-section .row {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .filters-section .nav-tabs {
    justify-content: center;
  }

  .quick-stats {
    flex-direction: row !important;
    justify-content: center !important;
  }

  .quick-stats > div {
    text-align: center !important;
  }
}

.quick-stats {
  display: flex;
  gap: 16px;
  align-items: center;
}

.quick-stats > div {
  text-align: center;
}

/* Nascondi elementi filtrati */
.hidden-by-search {
  display: none !important;
}

/* 🔍 Ricerca nella vista mensile */
.month-cell.search-match {
  background: rgba(var(--accent), 0.1) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(var(--accent), 0.2) !important;
  transform: scale(1.05);
}

.month-cell.search-no-match {
  opacity: 0.3 !important;
  filter: grayscale(0.8);
}

.month-cell.search-match .month-cell-date {
  color: var(--accent) !important;
  font-weight: 900;
}

/* 📊 Dashboard Metriche - Mobile Optimization */
@media (max-width: 640px) {
  .metrics-dashboard {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .metric-card {
    padding: 12px;
  }

  .metric-value {
    font-size: 18px;
  }

  .metric-label {
    font-size: 11px;
  }
}

/* 📅 Calendario Mobile */
@media (max-width: 640px) {
  .calendar-grid {
    font-size: 11px;
    min-height: 250px;
  }

  .calendar-header {
    padding: 6px;
    font-size: 12px;
  }

  .calendar-time-col {
    padding: 4px;
    font-size: 9px;
  }

  .booking-slot {
    font-size: 9px;
    padding: 2px 3px;
    min-height: 16px;
    line-height: 14px;
  }

  .booking-slot .slot-service,
  .booking-slot .slot-customer {
    margin: 0 2px;
  }
}

/* 📋 Booking Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  position: relative;
}

.booking-modal-content {
  width: 500px;
  max-width: 95vw;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

.booking-details-grid {
  display: grid;
  gap: 16px;
}

.detail-group {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  align-items: start;
}

.detail-group.full-width {
  grid-template-columns: 1fr;
}

.detail-label {
  font-weight: 600;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.detail-value {
  font-weight: 500;
  color: var(--text);
  word-break: break-word;
}

@media (max-width: 640px) {
  .modal {
    padding: 10px;
  }

  .booking-modal-content {
    width: 100%;
    max-width: 100vw;
  }

  .modal-header {
    padding: 16px 20px 12px;
  }

  .modal-body {
    padding: 20px;
  }

  .detail-group {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .detail-label {
    font-size: 12px;
  }
}

.modal-footer {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

@media (max-width: 640px) {
  .modal-footer {
    padding: 16px 20px;
    flex-wrap: wrap;
  }

  .modal-footer .btn {
    flex: 1;
    min-width: 120px;
  }
}

/* 🔔 Toast Notifications */
.booking-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 2000;
  animation: toastSlideIn 0.3s ease-out;
}

.toast-info {
  border-left: 4px solid var(--primary);
}

.toast-success {
  border-left: 4px solid var(--accent);
}

.toast-warning {
  border-left: 4px solid var(--warning);
}

.toast-error {
  border-left: 4px solid var(--danger);
}

.toast-content {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 2px;
}

.toast-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  margin: 0;
}

.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--muted);
  padding: 2px 4px;
  line-height: 1;
  border-radius: 4px;
  transition: all var(--transition-fast);
  margin-left: 8px;
}

.toast-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

@keyframes toastSlideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .booking-toast {
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .toast-content {
    padding: 14px;
  }

  .toast-message {
    font-size: 13px;
  }
}

/* 📱 Mobile Optimizations for Bookings Tab - Only for screens <= 640px */
@media (max-width: 640px) {
  /* Tab Prenotazioni Header - Mobile only */
  .booking-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .booking-header h2 {
    font-size: 18px;
    text-align: center;
  }

  .booking-actions {
    flex-direction: column;
    gap: 8px;
  }

  .quick-import-menu {
    order: -1;
  }

  /* Vista giornaliera calendario - Mobile only - FONT SIZE CORRETTI */
  .calendar-grid {
    font-size: 14px; /* AUMENTATO da 10px a 14px per leggibilità */
    min-height: 280px; /* AUMENTATO per migliore spaziatura */
    max-width: 100vw; /* PREVIENE overflow orizzontale */
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-grid > * {
    display: inline-block;
    vertical-align: top;
  }

  .calendar-header {
    padding: 8px; /* AUMENTATO da 4px */
    font-size: 14px; /* AUMENTATO da 10px */
    font-weight: 700;
  }

  .calendar-time-col {
    padding: 6px; /* AUMENTATO da 2px */
    font-size: 12px; /* AUMENTATO da 8px */
    min-width: 50px; /* AUMENTATO da 35px per leggibilità */
  }

  .calendar-staff-col {
    min-height: 24px; /* AUMENTATO da 18px */
  }

  .booking-slot {
    font-size: 12px; /* AUMENTATO da 8px */
    padding: 4px 6px; /* AUMENTATO da 1px 2px */
    min-height: 20px; /* AUMENTATO da 14px */
    line-height: 16px; /* AUMENTATO da 12px */
    border-left-width: 2px;
  }

  .booking-slot .slot-service,
  .booking-slot .slot-customer {
    display: block;
    margin: 0 3px;
  }

  /* Filtri e statistiche - Mobile only */
  .filters-section .row {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .quick-stats {
    flex-wrap: wrap;
    justify-content: space-around;
    gap: 12px;
  }

  .quick-stats > div {
    flex: 1 1 auto;
    min-width: 80px;
    text-align: center;
  }

  /* Navigazione mese - Mobile only - CORRETTO */
  .month-nav {
    padding: 12px 0;
    flex-wrap: nowrap; /* Impedisce di andare a capo */
    gap: 8px;          /* Riduce lo spazio tra frecce e testo */
    align-items: center;
  }

  .month-nav h3 {
    font-size: 18px;   /* Un po' più grande per leggibilità */
    flex: 1;           /* Occupa lo spazio centrale disponibile senza forzare l'a capo */
    width: auto;
    text-align: center;
    margin: 0;
  }

  .month-nav .btn {
    min-width: 44px;   /* Assicura che le frecce siano cliccabili */
    padding: 0;
  }

  .month-nav-buttons {
    flex: 1 1 100%;
    justify-content: center;
  }

  /* Vista mese - Mobile only */
  .month-grid {
    gap: 2px;
  }

  .month-cell {
    min-height: 55px; /* AUMENTATO per touch targets migliori */
    padding: 8px;
    font-size: 13px;
  }

  .month-cell-date {
    font-size: 14px;
    margin-bottom: 4px;
  }

  /* Modal nuova prenotazione - Mobile only - WIDTH CONSTRAINT AGGIUNTO */
  .new-booking-modal-content,
  .booking-modal-content {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 10px !important;
  }

  .new-booking-form {
    gap: 16px;
  }

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

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 14px; /* AUMENTATO da 12px per touch targets migliori */
    font-size: 16px;
    border-radius: 10px;
  }

  .form-group select {
    padding-right: 40px;
  }

  /* Pulsanti modal - Mobile only */
  .modal-footer {
    padding: 20px;
    flex-direction: column;
    gap: 12px;
  }

  .modal-footer .btn {
    width: 100%;
    min-height: 52px; /* AUMENTATO da 48px per touch targets ottimali */
    font-size: 16px;
  }

  /* Tab navigation - Mobile only */
  .nav-tabs {
    padding: 0 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav-tabs .tab-btn {
    padding: 12px 16px;
    font-size: 14px;
    min-height: 44px;
  }

  /* Search and filters bar - Mobile only */
  .search-filters-bar .row {
    gap: 10px;
    align-items: stretch;
  }

  .search-filters-bar input,
  .search-filters-bar select {
    padding: 12px 14px;
    font-size: 16px;
    min-height: 44px;
  }

  /* Metriche dashboard - Mobile only */
  .metrics-dashboard {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }

  .metric-card {
    padding: 16px;
  }

  .metric-value {
    font-size: 20px;
  }

  .metric-label {
    font-size: 12px;
  }

  /* ROW LAYOUT - FORZA VERTICALE SU MOBILE */
  .row {
    flex-direction: column !important; /* FORZA layout verticale */
    gap: 12px !important;
  }

  .row > * {
    flex: 1 1 auto !important; /* Permette espansione naturale */
    width: 100% !important; /* Larghezza completa */
  }
}

/* ➕ Modal Nuova Prenotazione - Mobile First */
.new-booking-modal-content {
  width: 100%;
  max-width: 100vw;
}

.new-booking-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 16px; /* Prevents zoom on iOS */
  -webkit-appearance: none;
  appearance: none;
}

.form-group select {
  background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDEyIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xIDFMNiA2TDExIDEiIHN0cm9rZT0iIzY5NzM4NSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+');
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 40px;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.availability-status {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.availability-status.available {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.availability-status.unavailable {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Tablet and larger screens */
@media (min-width: 641px) {
  .new-booking-modal-content {
    width: 600px;
    max-width: 95vw;
  }

  .new-booking-form {
    gap: 16px;
  }

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

  .form-group input,
  .form-group select,
  .form-group textarea {
    padding: 10px 12px;
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 16px;
  -webkit-appearance: none;
  appearance: none;
}

.form-group select {
  background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iOCIgdmlld0JveD0iMCAwIDEyIDgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGQ9Ik0xIDFMNiA2TDExIDEiIHN0cm9rZT0iIzY5NzM4NSIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz4KPC9zdmc+');
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 12px;
  padding-right: 30px;
}

.form-group textarea {
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.availability-status {
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.availability-status.available {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.availability-status.unavailable {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

/* Header section with title and new booking button */
.booking-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.booking-header h2 {
  margin: 0;
  font-size: 22px;
}

@media (max-width: 640px) {
  .booking-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .booking-header h2 {
    text-align: center;
    font-size: 20px;
  }

  .booking-header .btn {
    align-self: center;
    width: auto;
    min-width: 200px;
  }
}

.quick-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 640px) {
  .quick-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .quick-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* 📥 Import Calendario ICS */
.import-steps {
  margin-bottom: 16px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--muted);
}

.import-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.file-input-wrapper {
  position: relative;
}

.file-name {
  margin-top: 8px;
  font-size: 14px;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
}

.import-status {
  margin-top: 16px;
}

.import-progress {
  margin-bottom: 12px;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 80%, white));
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* 🎯 Import Contatti */
.import-methods {
  margin-bottom: 16px;
}

.method-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.import-section {
  display: none;
}

.import-section.active {
  display: block;
}

.method-info {
  padding: 12px;
  background: rgba(109, 40, 217, 0.1);
  border: 1px solid rgba(109, 40, 217, 0.2);
  border-radius: 8px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  .import-steps .step {
    font-size: 13px;
  }

  .file-name {
    font-size: 13px;
  }

  .method-tabs {
    flex-direction: column;
    gap: 6px;
  }

  .method-tabs .btn {
    width: 100%;
    justify-content: center;
  }

  .import-section .method-info {
    padding: 10px;
    font-size: 13px;
  }
}

@media (max-width: 640px) {
  .month-cell.search-match {
    transform: scale(1.02); /* Riduci scale su mobile per evitare overflow */
  }
}
