/* ── Custom styles beyond Tailwind ────────────────────────────────────────── */

/* Calendar week view */
.calendar-container {
  overflow-x: auto;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 60px repeat(7, 1fr);
  min-width: 700px;
}

.cal-time-col {
  grid-column: 1;
}

.cal-day-col {
  border-left: 1px solid #e2e8f0;
  position: relative;
  min-height: 720px; /* 12 hours * 60px */
}

.cal-hour-row {
  height: 60px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.7rem;
  color: #94a3b8;
  display: flex;
  align-items: flex-start;
  padding-top: 2px;
  padding-right: 4px;
  justify-content: flex-end;
}

.cal-day-header {
  text-align: center;
  padding: 6px 4px;
  font-size: 0.75rem;
  font-weight: 600;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
}

.cal-day-header.today {
  background: #0f766e;
  color: white;
  border-radius: 6px 6px 0 0;
}

.cal-day-body {
  position: relative;
  height: 720px; /* 12 hours * 60px */
}

.cal-hour-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: #f1f5f9;
}

.cal-appointment {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.7rem;
  overflow: hidden;
  cursor: pointer;
  z-index: 5;
  transition: opacity 0.15s;
}

.cal-appointment:hover {
  opacity: 0.85;
  z-index: 6;
}

.cal-appointment.scheduled {
  background: #0d9488;
  color: white;
  border-left: 3px solid #0f766e;
}

.cal-appointment.completed {
  background: #6b7280;
  color: white;
  border-left: 3px solid #4b5563;
}

.cal-appointment.cancelled {
  background: #fca5a5;
  color: #7f1d1d;
  border-left: 3px solid #ef4444;
  text-decoration: line-through;
  opacity: 0.7;
}

/* Modal animations */
.modal-backdrop {
  animation: fadeIn 0.15s ease;
}

.modal-box {
  animation: slideUp 0.2s ease;
}

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

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

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

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  border-radius: 24px;
  transition: 0.3s;
}

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

input:checked + .toggle-slider {
  background-color: #0d9488;
}

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

/* Sidebar */
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-radius: 8px;
  color: #cbd5e1;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
  text-decoration: none;
}

.sidebar-link:hover {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar-link.active {
  background: rgba(13,148,136,0.25);
  color: #5eead4;
}

/* Status badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-active    { background: #ccfbf1; color: #0f766e; }
.badge-inactive  { background: #f1f5f9; color: #64748b; }
.badge-scheduled { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #dcfce7; color: #15803d; }
.badge-cancelled { background: #fee2e2; color: #b91c1c; }
.badge-manual    { background: #f3f4f6; color: #374151; }
.badge-bot       { background: #ede9fe; color: #5b21b6; }

/* Loading spinner */
.spinner {
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Toast notification */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  max-width: 360px;
  transition: all 0.3s ease;
}

.toast-item {
  padding: 12px 16px;
  border-radius: 8px;
  color: white;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  margin-top: 8px;
  animation: slideLeft 0.3s ease;
}

.toast-success { background: #0d9488; }
.toast-error   { background: #dc2626; }
.toast-info    { background: #2563eb; }

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

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* Service item in form */
.service-item {
  display: grid;
  grid-template-columns: 1fr 120px 80px 36px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
