/* Soluntia App - Custom Styles */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --sidebar-width: 250px;
  --sidebar-bg: #1e1b4b;
  --sidebar-text: #c7d2fe;
  --topbar-height: 64px;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --grey: #9ca3af;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f8f9ff;
  color: #1f2937;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* ── LOGIN ─────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4f46e5 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-text {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.login-logo .logo-sub {
  display: block;
  font-size: 0.85rem;
  color: #6b7280;
  margin-top: 4px;
  font-weight: 400;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.login-card .form-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
}

.login-card .form-control {
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  padding: 10px 14px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.btn-login {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  width: 100%;
  transition: opacity 0.2s, transform 0.1s;
}

.btn-login:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  color: #fff;
}

.btn-login:active {
  transform: translateY(0);
}

/* ── DASHBOARD LAYOUT ───────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 1000;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo .logo-text {
  font-size: 1.6rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-dot {
  color: var(--primary-light);
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar-nav .nav-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(199, 210, 254, 0.45);
  padding: 8px 12px 4px;
  margin-top: 8px;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s;
  text-decoration: none;
  margin-bottom: 2px;
}

.sidebar-nav .nav-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

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

.sidebar-nav .nav-link.active {
  background: rgba(99, 102, 241, 0.25);
  color: #fff;
  border-left: 3px solid var(--primary-light);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-business-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-business-type {
  font-size: 0.75rem;
  color: rgba(199, 210, 254, 0.6);
  text-transform: capitalize;
  margin-bottom: 12px;
}

.btn-logout {
  width: 100%;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn-logout:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-date {
  font-size: 0.9rem;
  color: #6b7280;
  font-weight: 500;
}

.topbar-date span {
  color: #1f2937;
  font-weight: 700;
}

.btn-new-appointment {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  border: none;
  border-radius: 10px;
  padding: 9px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  text-decoration: none;
}

.btn-new-appointment:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  color: #fff;
}

/* Content Area */
.content-area {
  padding: 24px 28px;
  flex: 1;
}

/* Calendar */
.calendar-wrapper {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  border: 1px solid #f0f0f5;
  margin-bottom: 24px;
}

/* FullCalendar customization */
.fc .fc-toolbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #1f2937;
}

.fc .fc-button-primary {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  border-radius: 8px !important;
  font-weight: 500;
  font-size: 0.825rem;
  padding: 5px 12px;
}

.fc .fc-button-primary:hover {
  background: var(--primary-dark) !important;
  border-color: var(--primary-dark) !important;
}

.fc .fc-button-primary:disabled {
  background: var(--primary) !important;
  opacity: 0.5;
}

.fc .fc-daygrid-day-number {
  font-size: 0.82rem;
  color: #6b7280;
  font-weight: 500;
}

.fc .fc-day-today .fc-daygrid-day-number {
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fc .fc-day-today {
  background: rgba(99, 102, 241, 0.04) !important;
}

.fc-event {
  border-radius: 6px !important;
  font-size: 0.78rem !important;
  font-weight: 500 !important;
  border: none !important;
  padding: 2px 5px !important;
  cursor: pointer;
}

.fc-event.status-confirmed {
  background: #dcfce7 !important;
  color: #166534 !important;
}

.fc-event.status-cancelled {
  background: #fee2e2 !important;
  color: #991b1b !important;
  text-decoration: line-through;
}

.fc-event.status-completed {
  background: #f3f4f6 !important;
  color: #6b7280 !important;
}

.fc-event.status-pending {
  background: #fef9c3 !important;
  color: #854d0e !important;
}

/* Today's appointments panel */
.today-panel {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.07);
  border: 1px solid #f0f0f5;
}

.today-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.today-panel-title i {
  color: var(--primary);
}

.appointment-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
  background: #f9fafb;
  border: 1px solid #f0f0f5;
  cursor: pointer;
  transition: background 0.15s;
}

.appointment-item:hover {
  background: #f0f0f9;
}

.appt-time {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 50px;
  background: rgba(99,102,241,0.1);
  padding: 3px 6px;
  border-radius: 6px;
  text-align: center;
}

.appt-info {
  flex: 1;
  min-width: 0;
}

.appt-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.appt-phone {
  font-size: 0.78rem;
  color: #6b7280;
}

.appt-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}

.badge-confirmed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-completed { background: #f3f4f6; color: #6b7280; }
.badge-pending { background: #fef9c3; color: #854d0e; }

/* Config Section */
.config-section {
  display: none;
}

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

.schedule-day-row {
  background: #f9fafb;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 8px;
  border: 1px solid #e5e7eb;
}

.schedule-day-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: #374151;
  min-width: 90px;
}

/* Stats bar */
.stats-bar {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px 20px;
  border: 1px solid #f0f0f5;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  flex: 1;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1f2937;
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: #6b7280;
  margin-top: 4px;
  font-weight: 500;
}

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 8px;
}

.stat-confirmed .stat-icon { color: var(--success); }
.stat-cancelled .stat-icon { color: var(--danger); }
.stat-total .stat-icon { color: var(--primary); }
.stat-pending .stat-icon { color: var(--warning); }

/* Modals */
.modal-content {
  border-radius: 16px;
  border: none;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
  border-bottom: 1px solid #f0f0f5;
  padding: 20px 24px 16px;
}

.modal-title {
  font-weight: 700;
  color: #1f2937;
}

.modal-body {
  padding: 20px 24px;
}

.modal-footer {
  border-top: 1px solid #f0f0f5;
  padding: 16px 24px;
}

.form-label {
  font-weight: 600;
  color: #374151;
  font-size: 0.875rem;
  margin-bottom: 4px;
}

.form-control, .form-select {
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  padding: 9px 12px;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Realtime indicator */
.rt-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.75rem;
  color: #6b7280;
  font-weight: 500;
}

.rt-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  transition: background 0.3s;
}

.rt-dot.connected {
  background: var(--success);
  animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Toast notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
}

.soluntia-toast {
  background: #fff;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
  border-left: 4px solid var(--primary);
  max-width: 320px;
  margin-top: 8px;
  animation: slideIn 0.3s ease;
}

.soluntia-toast.success { border-left-color: var(--success); }
.soluntia-toast.error { border-left-color: var(--danger); }

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

/* Appointment detail card in modal */
.detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.detail-row i {
  color: var(--primary);
  font-size: 1rem;
  margin-top: 2px;
  min-width: 18px;
}

.detail-label {
  font-size: 0.8rem;
  color: #9ca3af;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-value {
  font-size: 0.9rem;
  color: #1f2937;
  font-weight: 600;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 32px 16px;
  color: #9ca3af;
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 8px;
  display: block;
}

.empty-state p {
  font-size: 0.9rem;
  margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  .stats-bar {
    flex-wrap: wrap;
  }

  .stat-card {
    min-width: calc(50% - 8px);
  }

  .content-area {
    padding: 16px;
  }

  .topbar {
    padding: 0 16px;
  }
}
