/* ============================================================
   BEAUTYSAAS — style.css  (mobile-first)
   ============================================================ */

:root {
  --brand: #8B5CF6;
  --brand-dark: #6D28D9;
  --brand-light: #EDE9FE;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --info: #3B82F6;

  --bg: #F9FAFB;
  --bg-card: #FFFFFF;
  --border: #E5E7EB;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;

  --sidebar-w: 240px;
  --header-h: 56px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
  --font: 'Inter', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1117;
    --bg-card: #1A1D27;
    --border: #2D3148;
    --text: #F1F5F9;
    --text-2: #94A3B8;
    --text-3: #64748B;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
  }
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .25s ease;
}
.sidebar.open { transform: translateX(0); }

@media (min-width: 768px) {
  .sidebar { transform: translateX(0); }
  .main-content { margin-left: var(--sidebar-w); }
}

.sidebar-logo {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo .logo-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--brand); display: flex; align-items: center;
  justify-content: center; font-size: 18px; color: #fff;
  flex-shrink: 0;
}
.sidebar-logo .company-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logo .plan-badge {
  font-size: 10px; color: var(--brand); background: var(--brand-light);
  padding: 1px 6px; border-radius: 20px; margin-top: 2px;
  display: inline-block;
}

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

.nav-section { margin-bottom: 4px; }
.nav-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .08em;
  padding: 8px 8px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background .15s, color .15s;
  border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--brand-light); color: var(--brand); }
.nav-item .icon { width: 18px; text-align: center; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto; background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
}

.sidebar-footer { padding: 12px 8px; border-top: 1px solid var(--border); }

/* Main content */
.main-content {
  flex: 1;
  display: flex; flex-direction: column;
  min-width: 0;
}

/* Header */
.topbar {
  height: var(--header-h); background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-menu-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 8px;
  border: 1px solid var(--border); background: none;
  cursor: pointer; color: var(--text); font-size: 18px;
}
@media (min-width: 768px) { .topbar-menu-btn { display: none; } }

.topbar-title { font-size: 16px; font-weight: 600; flex: 1; }

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

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--brand-light); color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

/* Page content */
.page { padding: 20px 16px; max-width: 1200px; }

@media (min-width: 768px) { .page { padding: 24px 28px; } }

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 20px; font-weight: 700; }

/* Overlay para mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-body { padding: 16px; }
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }

.stat-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
.stat-label { font-size: 12px; color: var(--text-2); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; }
.stat-sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* ============================================================
   BOTÕES
   ============================================================ */

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 14px;
  font-weight: 500; cursor: pointer; border: none;
  text-decoration: none; transition: opacity .15s, transform .1s;
  white-space: nowrap; user-select: none;
}
.btn:active { transform: scale(.97); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { opacity: .9; }

.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-icon { padding: 7px; border-radius: 8px; }
.btn-full { width: 100%; justify-content: center; }

/* ============================================================
   FORMULÁRIOS
   ============================================================ */

.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 5px; color: var(--text-2); }
.form-required::after { content: ' *'; color: var(--danger); }

.form-control {
  width: 100%; padding: 9px 12px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg-card);
  color: var(--text); font-size: 14px; font-family: var(--font);
  transition: border-color .15s;
  appearance: none;
}
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(139,92,246,.1); }
.form-control::placeholder { color: var(--text-3); }

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

select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }

.form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 480px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } }

/* ============================================================
   TABELAS
   ============================================================ */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  padding: 10px 12px; text-align: left; font-size: 11px;
  font-weight: 600; color: var(--text-2); text-transform: uppercase;
  letter-spacing: .06em; border-bottom: 1px solid var(--border);
  background: var(--bg); white-space: nowrap;
}
.table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }

/* ============================================================
   BADGES / PILLS
   ============================================================ */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.badge-success { background: #DCFCE7; color: #15803D; }
.badge-warning { background: #FEF9C3; color: #A16207; }
.badge-danger  { background: #FEE2E2; color: #B91C1C; }
.badge-info    { background: #DBEAFE; color: #1D4ED8; }
.badge-gray    { background: var(--bg); color: var(--text-2); border: 1px solid var(--border); }
.badge-purple  { background: var(--brand-light); color: var(--brand); }

/* ============================================================
   MODAL
   ============================================================ */

.modal-backdrop {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5); align-items: flex-end; justify-content: center;
  padding: 0;
}
.modal-backdrop.show { display: flex; }
@media (min-width: 480px) { .modal-backdrop { align-items: center; padding: 16px; } }

.modal {
  background: var(--bg-card); width: 100%; max-width: 520px;
  border-radius: 16px 16px 0 0; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
@media (min-width: 480px) { .modal { border-radius: var(--radius); } }

.modal-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg-card); z-index: 1;
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: var(--text-2); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); }

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

/* ============================================================
   AGENDA / CALENDÁRIO
   ============================================================ */

.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.calendar-date-nav { display: flex; align-items: center; gap: 8px; }
.calendar-date-nav .date-label { font-size: 15px; font-weight: 600; min-width: 180px; text-align: center; }

.time-grid { display: grid; gap: 1px; background: var(--border); border-radius: var(--radius); overflow: hidden; }

.time-slot {
  display: flex; align-items: stretch; min-height: 52px;
  background: var(--bg-card);
}
.time-label { width: 52px; flex-shrink: 0; padding: 4px 8px; font-size: 11px; color: var(--text-3); display: flex; align-items: flex-start; padding-top: 6px; }
.time-slot-content { flex: 1; padding: 2px 4px; }

.appointment-block {
  border-radius: 6px; padding: 4px 8px; margin: 1px 0;
  cursor: pointer; transition: opacity .15s; position: relative;
  font-size: 12px; overflow: hidden;
}
.appointment-block:hover { opacity: .85; }
.appointment-block .appt-time { font-size: 11px; opacity: .8; }
.appointment-block .appt-client { font-weight: 600; }
.appointment-block .appt-service { opacity: .85; }

/* ============================================================
   AGENDAMENTO PÚBLICO
   ============================================================ */

.booking-page { max-width: 480px; margin: 0 auto; padding: 20px 16px 40px; }
.booking-step { display: none; }
.booking-step.active { display: block; }

.service-list { display: flex; flex-direction: column; gap: 8px; }
.service-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: border-color .15s;
  background: var(--bg-card);
}
.service-item:hover, .service-item.selected { border-color: var(--brand); }
.service-item.selected { background: var(--brand-light); }
.service-name { font-weight: 600; font-size: 14px; }
.service-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.service-price { font-weight: 700; color: var(--brand); font-size: 15px; }

.prof-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px,1fr)); gap: 10px; }
.prof-card {
  text-align: center; padding: 16px 8px; border: 2px solid var(--border);
  border-radius: var(--radius); cursor: pointer; transition: border-color .15s;
  background: var(--bg-card);
}
.prof-card:hover, .prof-card.selected { border-color: var(--brand); }
.prof-card.selected { background: var(--brand-light); }
.prof-avatar {
  width: 52px; height: 52px; border-radius: 50%; background: var(--brand-light);
  color: var(--brand); display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; margin: 0 auto 8px;
}
.prof-name { font-size: 12px; font-weight: 600; }

.slots-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
@media (min-width: 360px) { .slots-grid { grid-template-columns: repeat(4,1fr); } }

.slot-btn {
  padding: 10px; border: 2px solid var(--border); border-radius: 8px;
  background: var(--bg-card); cursor: pointer; font-size: 14px; font-weight: 500;
  text-align: center; transition: border-color .15s, background .15s; color: var(--text);
}
.slot-btn:hover, .slot-btn.selected { border-color: var(--brand); background: var(--brand-light); color: var(--brand); }

.step-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; gap: 10px; }

/* Stepper dots */
.stepper { display: flex; justify-content: center; gap: 6px; margin-bottom: 24px; }
.stepper-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background .2s; }
.stepper-dot.active { background: var(--brand); width: 24px; border-radius: 4px; }

/* ============================================================
   UTILITÁRIOS
   ============================================================ */

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }

.grid-3 { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-muted { color: var(--text-2); }
.font-bold { font-weight: 700; }
.text-brand { color: var(--brand); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.hidden { display: none !important; }

/* Toast */
.toast-container { position: fixed; bottom: 16px; right: 16px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px; border-radius: 10px; font-size: 14px; font-weight: 500;
  color: #fff; min-width: 220px; max-width: 320px;
  animation: slideIn .3s ease; box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.toast-success { background: var(--success); }
.toast-error   { background: var(--danger); }
.toast-info    { background: var(--info); }

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

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--bg) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
