:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f0f3f9;
  --ink: #151824;
  --muted: #7d8493;
  --line: rgba(20, 28, 43, 0.08);
  --blue: #1d76f2;
  --purple: #8e35df;
  --teal: #25b7a5;
  --green: #21ba72;
  --orange: #f39b27;
  --pink: #d94bb6;
  --red: #e14f5a;
  --shadow: 0 18px 45px rgba(28, 41, 66, 0.12);
  --radius: 20px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(circle at 18% 6%, rgba(142, 53, 223, 0.15), transparent 30%),
    linear-gradient(145deg, #f0f4ff 0%, #f7f6ff 50%, #fafcff 100%);
  color: var(--ink);
  min-height: 100vh;
}

/* Layout SPA */
.app-shell {
  width: 100%;
  min-height: 100vh;
  position: relative;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
}

.screen {
  display: none;
  width: 100%;
  padding: 20px;
  flex: 1;
}

.screen.is-active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease;
}

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

/* Logo and Header */
.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.logo {
  max-height: 50px;
  max-width: 150px;
  object-fit: contain;
}

/* Elements card */
.card {
  background: transparent;
  padding: 0;
  margin-bottom: 20px;
}

/* Inputs y Formularios */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 15px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
}

input, select {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink);
  outline: none;
  font-size: 1rem;
  transition: all 0.2s ease;
}

input:focus, select:focus {
  border-color: var(--purple);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(142, 53, 223, 0.15);
}

/* Botones */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  width: 100%;
  font-size: 1rem;
  text-decoration: none;
}

.btn-primary {
  background: var(--purple);
  color: white;
  box-shadow: 0 8px 20px rgba(142, 53, 223, 0.25);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(142, 53, 223, 0.35);
}

.btn-outline {
  background: transparent;
  color: var(--purple);
  border: 2px solid var(--purple);
}

.btn-outline:hover {
  background: rgba(142, 53, 223, 0.05);
}

.btn-danger {
  background: var(--red);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  width: auto;
  font-size: 0.85rem;
}

/* Items lists (Tiendas, Categorías, Servicios) */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--surface);
  border-radius: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
  transition: all 0.2s ease;
  cursor: pointer;
}

.list-item:hover {
  transform: translateX(4px);
  border-color: var(--purple);
}

/* Catálogos y Servicios Premium Cards */
.catalog-card {
  height: 140px;
  border-radius: 16px;
  margin-bottom: 12px;
  position: relative;
  background-size: cover;
  background-position: center;
  overflow: hidden;
  color: white;
  display: flex;
  align-items: flex-end;
  padding: 15px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.25s ease;
}

.catalog-card:hover {
  transform: scale(1.02);
}

.catalog-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.2) 100%);
  z-index: 1;
}

.catalog-title {
  position: relative;
  z-index: 2;
  font-weight: 800;
  font-size: 1.2rem;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Items de Servicios */
.servicio-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 15px rgba(0,0,0,0.03);
  display: flex;
  gap: 15px;
  align-items: center;
}

.servicio-img {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  object-fit: cover;
  background: #eee;
  border: 1px solid var(--line);
}

.servicio-img-fallback {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.servicio-info {
  flex: 1;
}

.servicio-name {
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 4px 0;
}

.servicio-meta {
  font-size: 0.85rem;
  color: var(--muted);
  display: flex;
  gap: 12px;
}

.servicio-price {
  font-weight: 700;
  color: var(--purple);
}

/* Offcanvas Sidebar */
.offcanvas {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 650px;
  height: 85vh;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,0.15);
  z-index: 2000;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.offcanvas.is-open {
  transform: translateX(-50%) translateY(0);
}

.offcanvas-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(21, 24, 36, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1999;
  display: none;
}

.offcanvas-backdrop.is-visible {
  display: block;
}

.offcanvas-header {
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.offcanvas-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

/* Colaboradores grid */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.tech-card {
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--surface);
}

.tech-card.selected {
  border-color: var(--purple);
  background: rgba(142, 53, 223, 0.05);
}

.tech-avatar {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 8px;
  border: 2px solid white;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.tech-name {
  font-weight: 700;
  font-size: 0.9rem;
  margin: 0;
}

/* Cart badge floating */
.cart-floating-btn {
  position: fixed;
  bottom: 25px;
  right: 25px;
  background: var(--purple);
  color: white;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(142, 53, 223, 0.4);
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.2s ease;
}

.cart-floating-btn:hover {
  transform: scale(1.08);
}

.cart-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--red);
  color: white;
  font-size: 0.75rem;
  font-weight: 800;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* Cart layout items */
.cart-item {
  display: flex;
  justify-content: space-between;
  padding: 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  margin-bottom: 8px;
  border-radius: 12px;
}

/* Custom Calendar Slot Styles */
.time-slot {
  padding: 14px 8px;
  border-radius: 12px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--ink);
}

.time-slot:hover:not(.disabled) {
  border-color: var(--purple);
  background: rgba(142, 53, 223, 0.05);
  transform: translateY(-1px);
}

.time-slot.selected {
  background: var(--purple);
  color: white;
  border-color: var(--purple);
  box-shadow: 0 6px 15px rgba(142, 53, 223, 0.25);
}

.time-slot.disabled {
  background: rgba(20, 28, 43, 0.04);
  color: var(--muted);
  opacity: 0.45;
  border-color: transparent;
  cursor: not-allowed;
}

.time-slot.busy {
  background: rgba(225, 79, 90, 0.05);
  color: var(--red);
  border-color: rgba(225, 79, 90, 0.15);
  cursor: not-allowed;
  opacity: 0.75;
}

.time-slot.busy::after {
  content: "Ocupado";
  display: block;
  font-size: 0.65rem;
  font-weight: 850;
  text-transform: uppercase;
  margin-top: 2px;
}

/* SweetAlert2 z-index adjustment to be above offcanvas (z-index 2000) */
.swal2-container {
  z-index: 3000 !important;
}

/* Loyalty Program Custom Badges */
.badge-success { background: rgba(46, 204, 113, 0.15) !important; color: #2ecc71 !important; }
.badge-warning { background: rgba(241, 196, 15, 0.15) !important; color: #f1c40f !important; }
.badge-info { background: rgba(52, 152, 219, 0.15) !important; color: #3498db !important; }
.badge-danger { background: rgba(231, 76, 60, 0.15) !important; color: #e74c3c !important; }
.badge-primary { background: rgba(155, 89, 182, 0.15) !important; color: #9b59b6 !important; }
.badge-secondary { background: rgba(149, 165, 166, 0.15) !important; color: #95a5a6 !important; }

/* AI Animated Icon and Glow */
.ai-glow-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 15px auto;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.1) 0%, rgba(99, 102, 241, 0.1) 100%);
  position: relative;
}

.ai-glow-icon {
  font-size: 2.8rem;
  background: linear-gradient(135deg, #a855f7 0%, #6366f1 50%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: aiPulse 2.2s infinite ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.ai-glow-pulse {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px dashed rgba(99, 102, 241, 0.35);
  animation: aiRotate 10s infinite linear;
  z-index: 1;
}

@keyframes aiPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 5px rgba(168, 85, 247, 0.4));
  }
  50% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 15px rgba(99, 102, 241, 0.7));
  }
}

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

