:root{
  --primary:#6d28d9;
  --bg:#0b0f19;
  --text:#ffffff;

  --card:#121a2a;
  --muted:rgba(255,255,255,.72);
  --border:rgba(255,255,255,.12);

  --radius:16px;
  --shadow: 0 10px 30px rgba(0,0,0,.35);

  --space:16px;
  --max: 980px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

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

.container{
  width:100%;
  max-width: var(--max);
  margin:0 auto;
  padding:16px;
}

.topbar{
  position:sticky; top:0;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.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,.08);
  border:1px solid var(--border);
}

.brand-name{
  font-weight:800;
  letter-spacing:.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,.05);
  color: var(--muted);
  font-size:13px;
}

.card{
  background: color-mix(in srgb, var(--card) 92%, transparent);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:16px;
}

.grid{
  display:grid;
  gap:16px;
}

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

.btn{
  height:48px;
  min-height:48px;
  padding:0 16px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-weight:700;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
  user-select:none;
  -webkit-tap-highlight-color: transparent;
}

.btn:active{ transform: translateY(1px); }
.btn.primary{
  background: color-mix(in srgb, var(--primary) 88%, black);
  border-color: color-mix(in srgb, var(--primary) 55%, white);
}
.btn.ghost{
  background: transparent;
}
.btn.danger{
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.35);
}

input, select, textarea{
  width:100%;
  padding:12px 12px;
  border-radius:14px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  outline:none;
}
input::placeholder, textarea::placeholder{ color: rgba(255,255,255,.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{
  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,.22);
  border:1px solid var(--border);
}
.step-dot.active{
  background: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 55%, white);
}

.h1{font-size:22px;margin:0 0 8px}
.p{color:var(--muted);margin:0 0 12px;line-height:1.45}

.service-grid{
  display:grid;
  gap:12px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px){
  .service-grid{ grid-template-columns: repeat(2, 1fr); }
}
.service-card{
  display:flex; gap:12px;
  padding:12px;
  border-radius: var(--radius);
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  transition: transform .08s ease, border-color .15s ease, background .15s ease;
}
.service-card:active{ transform: translateY(1px); }
.service-card.selected{
  border-color: color-mix(in srgb, var(--primary) 55%, white);
  background: color-mix(in srgb, var(--primary) 16%, rgba(255,255,255,.04));
}
.service-thumb{
  width:78px; height:78px;
  border-radius:16px;
  object-fit:cover;
  border:1px solid var(--border);
  background: rgba(255,255,255,.07);
}
.service-meta{flex:1}
.service-name{font-weight:900; margin:0 0 4px}
.service-sub{margin:0; font-size:13px; color:var(--muted)}
.price{
  font-weight:900;
  padding:8px 10px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.05);
  height: fit-content;
}

.slot-grid{
  display:grid;
  gap:10px;
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 520px){
  .slot-grid{ grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 860px){
  .slot-grid{ grid-template-columns: repeat(4, 1fr); }
}
.slot{
  height:44px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.05);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  cursor:pointer;
  user-select:none;
}
.slot.selected{
  background: color-mix(in srgb, var(--primary) 24%, rgba(255,255,255,.06));
  border-color: color-mix(in srgb, var(--primary) 60%, white);
}
.slot.disabled{
  opacity:.45;
  cursor:not-allowed;
}

/* Staff Selection Grid */
.staff-grid{
  display:grid;
  gap:12px;
  grid-template-columns: 1fr;
  margin-top: 12px;
}
@media (min-width: 640px){
  .staff-grid{ grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 860px){
  .staff-grid{ grid-template-columns: repeat(3, 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,.04);
  cursor:pointer;
  transition: transform .08s ease, border-color .15s ease, background .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,.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:16px 0;
}

.nav-tabs{
  display:flex; gap:10px; flex-wrap:wrap;
}
.tab-btn{
  padding:10px 12px;
  border-radius:999px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  font-weight:800;
}
.tab-btn.active{
  background: color-mix(in srgb, var(--primary) 18%, rgba(255,255,255,.06));
  border-color: color-mix(in srgb, var(--primary) 55%, white);
}

.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius: var(--radius);
  border:1px solid var(--border);
}
.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,.04); }
.table tr:last-child td{ border-bottom:none; }

.toast{
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 14px;
  border-radius: 999px;
  border:1px solid var(--border);
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(10px);
  color: var(--text);
  z-index: 9999;
  max-width: calc(100% - 32px);
  box-shadow: var(--shadow);
}

/* 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;
}

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

.calendar-time-col{
  background: rgba(255,255,255,.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,.03);
  position: relative;
  height: 100%;
}

.booking-slot{
  position: absolute;
  left: 4px;
  right: 4px;
  padding: 0 4px;      /* Padding minimo */
  font-size: 10px;     /* Testo piccolo */
  line-height: 20px;   /* Centra il testo nell'altezza riga */
  border-left-width: 2px; /* Bordo più sottile */
  border-left-style: solid;
  border-radius: 4px;
  background: rgba(255,255,255,.15);
  backdrop-filter: blur(2px);
  cursor: pointer;
  transition: transform .08s ease, background .15s ease;
  
  /* Gestione testo lungo */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  
  /* Flex per allineare */
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Nascondi i dettagli extra se lo slot è troppo piccolo */
.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,.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;
}

/* Rendi la colonna orari più discreta */
.calendar-time-col{
  font-size: 10px;
  color: var(--muted);
  border-bottom: 1px dotted rgba(255,255,255,.05); /* Riga guida orizzontale */
  display: flex;
  align-items: flex-start; /* Orario in alto */
  justify-content: center;
  padding-top: 4px;
  background: rgba(255,255,255,.02);
  padding: 8px;
  border-right: 1px solid var(--border);
  text-align: center;
}

.calendar-staff-col{
  border-bottom: 1px dotted rgba(255,255,255,.05); /* Riga guida orizzontale */
  border-right: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  position: relative;
  height: 100%;
}

.calendar-empty{
  background: rgba(255,255,255,.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;
}

/* Responsive: sticky summary su mobile in basso */
@media (max-width: 860px){
  .sticky-summary{
    top: auto;
    bottom: 16px;
    right: 16px;
    left: 16px;
    max-width: none;
    transform: translateY(10px);
  }
}

/* Badge Notifiche */
.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);
}

/* Vista Mensile */
.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 16px;
}
.month-cell {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 80px;
  padding: 8px;
  cursor: pointer;
  transition: all .2s ease;
  position: relative;
}
.month-cell:hover { background: rgba(255,255,255,.08); border-color: var(--primary); }
.month-cell.today { border-color: var(--primary); background: rgba(255,255,255,.06); }
.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); }

/* Header Navigazione Mese */
.month-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

/* 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-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: 1px dashed #fbbf24 !important;
  color: #fbbf24;
}

/* Stile per bottoni success (verde) */
.btn.success {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.35);
}

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