@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  /* Paleta oficial Turnoy */
  --primary: #2563EB;       /* Azul primario */
  --primary-dark: #1E3A8A;  /* Azul oscuro (navy) */
  --success: #22C55E;       /* Verde check */
  --success-dark: #16A34A;
  --whatsapp: #22C55E;      /* WhatsApp = mismo verde de la marca */
  --whatsapp-dark: #16A34A;
  --bg: #F3F4F6;            /* Gris claro para fondos */
  --surface: #ffffff;
  --border: #e5e7eb;
  --text: #1E3A8A;          /* Texto principal = navy */
  --text-body: #111827;
  --text-muted: #6B7280;
  --navy: #374151;          /* Gris oscuro para footer */
  --warning: #f59e0b;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}

body, input, button, select, textarea {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

/* Evita zoom en iOS al enfocar inputs */
input, select, textarea, button { font: inherit; font-size: 16px; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.site-header h1 { font-size: 22px; }
.site-header .city-tag { color: var(--text-muted); font-size: 14px; }

/* Search bar */
.search-bar {
  display: flex;
  gap: 8px;
  margin: 20px 0;
  flex-wrap: wrap;
}
.search-bar input, .search-bar select {
  flex: 1;
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 15px;
}
.search-bar input:focus, .search-bar select:focus {
  outline: 2px solid var(--primary);
  outline-offset: -1px;
  border-color: var(--primary);
}

/* Categories chips */
.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  color: var(--text);
}
.chip:hover { background: #f1f5f9; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Cards grid */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s, box-shadow 0.15s;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 10px 15px rgba(0,0,0,0.08); }
.card a { color: inherit; text-decoration: none; }
.card .cover {
  height: 120px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  background-size: cover;
  background-position: center;
}
.card-body { padding: 14px; }
.card .name { font-weight: 600; font-size: 17px; margin-bottom: 4px; }
.card .meta { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.card .badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--primary);
  font-weight: 500;
}
.badge.warn { background: #fef3c7; color: #92400e; }
.badge.success { background: #dcfce7; color: #166534; }
.badge.featured { background: #fef3c7; color: #92400e; }

/* Booking page */
.booking-cover {
  height: 200px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  background-size: cover;
  background-position: center;
}
.booking-header {
  background: var(--surface);
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}
.booking-header h1 { font-size: 26px; margin-bottom: 6px; }
.booking-header .desc { color: var(--text-muted); margin-top: 6px; }
.booking-header .info { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; font-size: 14px; color: var(--text-muted); }

.section { background: var(--surface); border-radius: var(--radius); padding: 18px; margin: 16px 0; box-shadow: var(--shadow); }
.section h2 { font-size: 18px; margin-bottom: 12px; }

/* Service / Staff list (selectable) */
.list-select { display: flex; flex-direction: column; gap: 8px; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  background: var(--surface);
}
.list-item:hover { border-color: var(--primary); }
.list-item.selected { background: #eff6ff; border-color: var(--primary); }
.list-item .name { font-weight: 500; }
.list-item .meta { color: var(--text-muted); font-size: 13px; }
.list-item .price { font-weight: 600; color: var(--text); }

/* Slot grid */
.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 8px;
}
@media (max-width: 400px) {
  .slot-grid { grid-template-columns: repeat(auto-fill, minmax(66px, 1fr)); gap: 6px; }
  .slot { padding: 10px 4px; font-size: 13px; }
}
.slot {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  font-weight: 500;
  font-size: 14px;
}
.slot:hover { border-color: var(--primary); }
.slot.selected { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 20px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.15s;
}
.btn:hover { background: var(--primary-dark); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.btn-secondary:hover { background: #f1f5f9; }
.btn.btn-block { width: 100%; }
.btn.btn-whatsapp { background: var(--whatsapp); }
.btn.btn-whatsapp:hover { background: var(--whatsapp-dark); }
.btn.btn-danger { background: var(--danger); }
.btn.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Panel layout (sidebar + main) */
.panel { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  z-index: 50;
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 40;
}
.sidebar .brand { padding: 0 20px 20px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.sidebar .brand h1 { font-size: 20px; }
.sidebar .brand .tag { font-size: 12px; color: var(--text-muted); }
.sidebar nav a {
  display: block;
  padding: 10px 20px;
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
  border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: var(--bg); }
.sidebar nav a.active { border-left-color: var(--primary); background: #eff6ff; color: var(--primary); font-weight: 500; }
.sidebar .nav-group { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; padding: 14px 20px 6px; }
.sidebar .bottom { padding: 14px 20px; border-top: 1px solid var(--border); margin-top: 14px; font-size: 13px; color: var(--text-muted); }

.main-area { padding: 24px 32px; }
.main-area h2.page-title { font-size: 24px; margin-bottom: 4px; }
.main-area .page-sub { color: var(--text-muted); margin-bottom: 20px; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.stat-card .label { color: var(--text-muted); font-size: 13px; margin-bottom: 6px; }
.stat-card .value { font-size: 26px; font-weight: 600; }
.stat-card .sub { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* Table */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: var(--bg); font-weight: 600; color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--bg); }

/* Toolbar (sobre tablas/listas) */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input, .toolbar select { padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.toolbar .spacer { flex: 1; }

.mobile-toggle { display: none; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: 15px; }

@media (max-width: 900px) {
  .panel { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 260px; height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open ~ .sidebar-backdrop { display: block; }
  .main-area { padding: 16px; }
  .mobile-toggle { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; }
  .main-area h2.page-title { font-size: 20px; }
}

/* Responsive base */
@media (max-width: 640px) {
  .container { padding: 0 12px; }
  .main-area { padding: 14px; }
  .section { padding: 14px; }
  .site-header h1 { font-size: 18px; }
  .btn { padding: 11px 16px; font-size: 15px; }
  .btn.btn-sm { padding: 8px 12px; font-size: 13px; }
  .toolbar { gap: 8px; }
  .toolbar input, .toolbar select { flex: 1 1 140px; min-width: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 22px; }
  .modal { padding: 18px; border-radius: 12px 12px 0 0; max-height: 92vh; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal-actions { flex-direction: column-reverse; gap: 10px; }
  .modal-actions .btn { width: 100%; }
  .search-bar { flex-direction: column; }
  .search-bar input, .search-bar select { min-width: 0; }
  .cards { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; }
  .tab { white-space: nowrap; flex-shrink: 0; }
}

/* Tablas con scroll horizontal en móvil */
@media (max-width: 900px) {
  .main-area > *,
  .section {
    max-width: 100%;
  }
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .table thead, .table tbody, .table tr { display: table; width: max-content; min-width: 100%; table-layout: auto; }
}

/* Tap targets grandes */
@media (hover: none) {
  .btn, button, input[type="checkbox"], input[type="radio"], a.chip { min-height: 40px; }
}

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 14px; margin-bottom: 6px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 16px;
  background: var(--surface);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: var(--primary); }

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 12px 0;
  font-size: 14px;
}
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* Loader */
.loader { text-align: center; padding: 40px; color: var(--text-muted); }
.empty { text-align: center; padding: 40px; color: var(--text-muted); }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px;
  overflow-y: auto;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  max-width: 420px; width: 100%;
  padding: 24px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  margin: auto;
}
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }

/* Tabs */
.tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab { padding: 10px 16px; cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; color: var(--text-muted); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

@media (max-width: 600px) {
  .booking-cover { height: 140px; }
  .booking-header h1 { font-size: 22px; }
}
