/* ============================================================
   AesthetiCare — main.css
   Sistema de diseño principal. Mobile-first.
   Colores y tipografía como variables CSS.
   ============================================================ */

/* ---- Variables del sistema de diseño ---- */
:root {
  /* Colores */
  --color-bg: #FAF7F2;
  --color-sidebar: #3D2B2B;
  --color-sidebar-hover: #4f3838;
  --color-primary: #D4A5A5;
  --color-primary-dark: #c08f8f;
  --color-secondary: #3D2B2B;
  --color-accent: #A8B5A2;
  --color-text: #3D2B2B;
  --color-text-light: #7A6A6A;
  --color-text-muted: #a89a9a;
  --color-success: #A8B5A2;
  --color-warning: #E8C97A;
  --color-danger: #E89A9A;
  --color-white: #FFFFFF;
  --color-border: #EDE5DC;
  --color-shadow: rgba(61, 43, 43, 0.08);

  /* Tipografía */
  --font-heading: 'Playfair Display', serif;
  --font-body: 'DM Sans', sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 2rem;

  /* Espaciado */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Bordes */
  --radius-card: 16px;
  --radius-pill: 24px;
  --radius-btn: 12px;
  --radius-sm: 8px;

  /* Sombras */
  --shadow-card: 0 4px 24px var(--color-shadow);
  --shadow-sm: 0 2px 8px var(--color-shadow);

  /* Sidebar */
  --sidebar-width: 240px;
  --header-height: 64px;
  --mobile-nav-height: 72px;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100vw;
  touch-action: manipulation;
  -webkit-text-size-adjust: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ---- Tipografía ---- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.3;
  color: var(--color-text);
}

h1 { font-size: var(--font-size-3xl); font-weight: 700; }
h2 { font-size: var(--font-size-2xl); font-weight: 600; }
h3 { font-size: var(--font-size-xl);  font-weight: 600; }
h4 { font-size: var(--font-size-lg);  font-weight: 500; }

/* ---- Layout mobile-first ---- */

/* En mobile: una sola columna, el contenido ocupa todo el ancho */
.main-wrapper {
  min-height: 100vh;
  padding-bottom: var(--mobile-nav-height); /* espacio para nav inferior */
  max-width: 100vw;
  overflow-x: hidden;
}

.page-content {
  padding: var(--space-4);
  max-width: 100vw;
  overflow-x: hidden;
}

/* Header superior (oculto en mobile) */
.top-header {
  display: none;
}

/* Sidebar (oculto en mobile) */
.sidebar {
  display: none;
}

/* ---- Botones ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-btn);
  font-size: var(--font-size-sm);
  font-weight: 500;
  transition: background-color 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background-color: var(--color-primary-dark);
  color: var(--color-white);
}
.btn-primary:hover { background-color: var(--color-primary-dark); }

.btn-outline {
  background-color: transparent;
  border: 1.5px solid var(--color-primary);
  color: var(--color-primary);
}
.btn-outline:hover {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.btn-danger {
  background-color: var(--color-danger);
  color: var(--color-white);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-size-xs);
  border-radius: var(--radius-sm);
}

/* ---- Cards ---- */
.card {
  background: var(--color-white);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: var(--space-6);
}

/* ---- Formularios ---- */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.label-required {
  color: var(--color-danger);
  font-weight: 500;
  margin-left: 1px;
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-white);
  color: var(--color-text);
  font-size: var(--font-size-base);
  line-height: 1.5;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-control:hover {
  border-color: var(--color-primary);
}

.form-control:focus,
.form-control:focus-visible {
  outline: none;
  border-color: var(--color-primary-dark);
  box-shadow: 0 0 0 4px rgba(212, 165, 165, 0.15);
}

.form-control::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.form-control:disabled {
  background-color: var(--color-bg);
  color: var(--color-text-muted);
  cursor: not-allowed;
}

select.form-control {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%237A6A6A' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

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

/* Input dates: estilizar icono nativo */
input[type="date"].form-control {
  padding-right: 1rem;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s;
}

input[type="date"].form-control:hover::-webkit-calendar-picker-indicator,
input[type="date"].form-control:focus::-webkit-calendar-picker-indicator {
  opacity: 1;
}

/* ---- Badges de estado ---- */
.badge {
  display: inline-block;
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: 500;
}

.badge--programada  { background-color: #EEF2FF; color: #4F46E5; }
.badge--confirmada  { background-color: #F0FDF4; color: #16A34A; }
.badge--en_proceso  { background-color: #FFF7ED; color: #EA580C; }
.badge--completada  { background-color: #F0FDF4; color: #15803D; }
.badge--cancelada   { background-color: #FFF1F1; color: #DC2626; }
.badge--no_asistio  { background-color: #F5F5F5; color: #737373; }

/* ---- Tabla ---- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-card);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

thead th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-bg);
  color: var(--color-text-light);
  font-weight: 500;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

tbody td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background-color: #FAF7F2; }

/* ---- Mensajes del sistema ---- */
.messages-container {
  padding: var(--space-4);
  padding-bottom: 0;
}

/* ---- Página de autenticación ---- */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background-color: var(--color-bg);
  padding: var(--space-4);
}

.auth-container {
  width: 100%;
  max-width: 440px;
}

/* ---- Icono botón ---- */
.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  color: var(--color-text-light);
  transition: background-color 0.2s, color 0.2s;
}

.icon-btn:hover {
  background-color: var(--color-border);
  color: var(--color-text);
}

/* ============================================================
   Toast notifications (floating, slide-in from right)
   ============================================================ */
.toast {
  pointer-events: auto;
  background: var(--color-white);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(61,43,43,0.18);
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--color-primary);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.toast.show {
  transform: translateX(0);
  opacity: 1;
}
.toast.removing {
  transform: translateX(120%);
  opacity: 0;
}
.toast--start { border-left-color: var(--color-primary); }
.toast--complete { border-left-color: var(--color-warning); }
.toast--payment { border-left-color: var(--color-danger); }
