* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu,
    Cantarell, sans-serif;
  background: #f5f5f5;
  color: #333;
  line-height: 1.6;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* Header */
.header {
  background: white;
  padding: 20px 30px;
  margin-bottom: 30px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-logo-img {
  height: 50px;
  width: auto;
}

.header-subtitle {
  font-size: 18px;
  color: #7f8c8d;
  font-weight: 500;
}

.header h1 {
  font-size: 28px;
  color: #2c3e50;
  margin: 0;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.user-info span {
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.btn-logout {
  padding: 8px 16px;
  background: #e74c3c;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  transition: all 0.3s ease;
}

.btn-logout:hover {
  background: #c0392b;
  transform: translateY(-2px);
}

.controls {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.view-selector {
  display: flex;
  gap: 10px;
}

.view-btn {
  padding: 10px 20px;
  border: 2px solid #3498db;
  background: white;
  color: #3498db;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.view-btn.active {
  background: #3498db;
  color: white;
}

.view-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.date-navigation {
  display: flex;
  align-items: center;
  gap: 15px;
}

.nav-btn {
  padding: 10px 16px;
  background: #34495e;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 18px;
  transition: all 0.3s ease;
}

.nav-btn:hover {
  background: #2c3e50;
  transform: scale(1.05);
}

.current-date {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  min-width: 200px;
  text-align: center;
}

.today-btn {
  padding: 10px 20px;
  background: #27ae60;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.3s ease;
}

.today-btn:hover {
  background: #229954;
  transform: translateY(-2px);
}

/* Legenda */
.legend {
  background: white;
  padding: 15px 30px;
  margin-bottom: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.legend-color {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 2px solid rgba(0, 0, 0, 0.1);
}

.legend-color.verde {
  background: #27ae60;
}

.legend-color.arancione {
  background: #e67e22;
}

.legend-color.azzurra {
  background: #3498db;
}

.legend-label {
  font-weight: 600;
  color: #2c3e50;
}

/* Calendario */
.calendar {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

/* Vista Giornaliera - Layout Tabella */
.day-view {
  overflow-x: auto;
}

.day-view table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.day-view thead th {
  padding: 20px;
  font-weight: 700;
  font-size: 16px;
  text-align: center;
  background: white;
  border-bottom: 3px solid;
  position: sticky;
  top: 0;
  z-index: 10;
}

.day-view thead th:first-child {
  background: #f8f9fa;
  border-bottom-color: #95a5a6;
  color: #7f8c8d;
  min-width: 80px;
}

.day-view thead th.verde {
  border-bottom-color: #27ae60;
  color: #27ae60;
  min-width: 250px;
}

.day-view thead th.arancione {
  border-bottom-color: #e67e22;
  color: #e67e22;
  min-width: 250px;
}

.day-view thead th.azzurra {
  border-bottom-color: #3498db;
  color: #3498db;
  min-width: 250px;
}

.day-view tbody tr {
  border-bottom: 1px solid #e0e0e0;
}

.day-view tbody td {
  padding: 12px;
  min-height: 60px;
  border-right: 1px solid #e0e0e0;
}

.day-view tbody td:first-child {
  background: #f8f9fa;
  text-align: center;
  font-size: 13px;
  color: #7f8c8d;
  font-weight: 600;
  width: 80px;
}

.day-view tbody td.empty-slot {
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-view tbody td.empty-slot:hover {
  background: #f8f9fa;
}

.day-view tbody td.booked {
  cursor: pointer;
  transition: all 0.2s ease;
}

.day-view tbody td.booked:hover {
  opacity: 0.9;
}

.day-view tbody td.booked.verde {
  background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
  color: white;
}

.day-view tbody td.booked.arancione {
  background: linear-gradient(135deg, #e67e22 0%, #f39c12 100%);
  color: white;
}

.day-view tbody td.booked.azzurra {
  background: linear-gradient(135deg, #3498db 0%, #5dade2 100%);
  color: white;
}

.booking-info {
  font-size: 13px;
}

.booking-info strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}

.booking-info .note {
  font-size: 12px;
  opacity: 0.9;
  margin-top: 4px;
  font-style: italic;
}

/* Vista Settimanale */
.week-view {
  overflow-x: auto;
}

.week-view table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.week-view thead th {
  padding: 15px;
  font-weight: 700;
  text-align: center;
  background: white;
  border-bottom: 3px solid #3498db;
  position: sticky;
  top: 0;
  z-index: 10;
}

.week-view thead th:first-child {
  background: #f8f9fa;
  border-bottom-color: #95a5a6;
  color: #7f8c8d;
  min-width: 80px;
}

.week-view tbody tr {
  border-bottom: 1px solid #e0e0e0;
}

.week-view tbody td {
  padding: 8px;
  min-height: 50px;
  border-right: 1px solid #e0e0e0;
  vertical-align: top;
}

.week-view tbody td:first-child {
  background: #f8f9fa;
  text-align: center;
  font-size: 13px;
  color: #7f8c8d;
  font-weight: 600;
  width: 80px;
}

/* Vista Mensile */
.month-view {
  padding: 20px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
}

.month-day-header {
  padding: 10px;
  text-align: center;
  font-weight: 700;
  color: #7f8c8d;
  font-size: 14px;
}

.month-day {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  min-height: 120px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.month-day:hover {
  border-color: #3498db;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.month-day.other-month {
  opacity: 0.4;
}

.month-day.today {
  border-color: #e74c3c;
  background: #fef5e7;
}

.month-day-number {
  font-weight: 700;
  font-size: 18px;
  color: #2c3e50;
  margin-bottom: 8px;
}

.month-booking {
  font-size: 10px;
  padding: 4px 6px;
  border-radius: 4px;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-booking.verde {
  background: #27ae60;
  color: white;
}

.month-booking.arancione {
  background: #e67e22;
  color: white;
}

.month-booking.azzurra {
  background: #3498db;
  color: white;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(50px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  margin-bottom: 25px;
}

.modal-header h2 {
  font-size: 24px;
  color: #2c3e50;
  margin-bottom: 5px;
}

.modal-header .subtitle {
  color: #7f8c8d;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #2c3e50;
  font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

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

.time-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 25px;
}

.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  flex: 1;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover {
  background: #2980b9;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover {
  background: #c0392b;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-secondary {
  background: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background: #7f8c8d;
}

.info-row {
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e0e0e0;
}

.info-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.info-row label {
  display: block;
  font-size: 12px;
  color: #7f8c8d;
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-row .value {
  font-size: 16px;
  color: #2c3e50;
  font-weight: 600;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: #7f8c8d;
}

.loading-spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

/* Responsive */
@media (max-width: 1024px) {
  .day-view {
    grid-template-columns: 60px repeat(3, 1fr);
  }

  .week-view {
    overflow-x: auto;
  }
}

@media (max-width: 768px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .date-navigation {
    justify-content: space-between;
  }

  .month-grid {
    grid-template-columns: repeat(7, minmax(100px, 1fr));
    overflow-x: auto;
  }

  .day-view,
  .week-view {
    font-size: 12px;
  }
}
