/* ==========================================================================
   AgendarX Stylesheet (Clean, Mobile-First, Secure)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary-hsl: 222, 89%, 25%;
  --primary: hsl(var(--primary-hsl));
  --primary-light: hsl(222, 89%, 95%);
  --primary-medium: hsl(222, 89%, 60%);
  --secondary: hsl(152, 60%, 45%);
  --secondary-light: hsl(152, 60%, 94%);
  --accent: hsl(200, 95%, 45%);
  
  --bg-app: #f4f6fc;
  --bg-card: #ffffff;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-danger: #ef4444;
  --color-danger-bg: #fef2f2;
  
  --radius-sm: 0px;
  --radius-md: 0px;
  --radius-lg: 0px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 10px 15px -3px rgba(30, 41, 59, 0.05), 0 4px 6px -2px rgba(30, 41, 59, 0.02);
  --shadow-lg: 0 20px 25px -5px rgba(30, 41, 59, 0.1), 0 10px 10px -5px rgba(30, 41, 59, 0.04);
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body.dark-mode {
  --bg-app: #0f172a;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border: #334155;
  --primary-light: rgba(59, 130, 246, 0.1);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  position: relative;
  box-shadow: 0 0 40px rgba(0,0,0,0.03);
}

@media (min-width: 992px) {
  .app-container {
    max-width: 960px;
    margin: 40px auto;
    min-height: calc(100vh - 80px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
  }
}

header {
  padding: 20px 24px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
}

.logo-text {
  font-weight: 700;
  font-size: 1.3rem;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.theme-toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: var(--transition);
}

.theme-toggle-btn:hover {
  background-color: var(--primary-light);
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px;
}

.screen.hidden {
  display: none !important;
}

.auth-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  margin: auto 0;
  text-align: center;
  animation: slideUp 0.4s ease-out;
}

.auth-card h2 {
  font-weight: 700;
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.auth-card p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.form-group {
  margin-bottom: 20px;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input-wrapper {
  position: relative;
}

.input-wrapper i {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 14px 16px 14px 44px;
  font-family: var(--font-family);
  font-size: 1rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background-color: var(--bg-app);
  color: var(--text-main);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-medium);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  background-color: var(--bg-card);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-medium));
  color: white;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
}

.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--text-muted);
  color: white;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

.register-container {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  animation: fadeIn 0.3s ease-out;
}

.register-container h2 {
  font-weight: 700;
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* Alert styles */
.alert-box {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
  text-align: left;
  border-left: 4px solid;
}

.alert-danger {
  background-color: var(--color-danger-bg);
  border-left-color: var(--color-danger);
  color: #7f1d1d;
}

.alert-success {
  background-color: var(--color-success-bg);
  border-left-color: var(--color-success);
  color: #065f46;
}

.otp-simulation-badge {
  background-color: var(--color-warning-bg);
  border: 1.5px dashed var(--color-warning);
  color: #92400e;
  padding: 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

/* Steps trackers */
.steps-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  position: relative;
}

.steps-line {
  position: absolute;
  top: 50%;
  left: 10%;
  right: 10%;
  height: 2px;
  background-color: var(--border);
  z-index: 1;
}

.steps-line-fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background-color: var(--accent);
  transition: width 0.3s ease;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background-color: var(--bg-app);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  z-index: 2;
  transition: var(--transition);
}

.step-dot.active {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.step-dot.completed {
  background-color: var(--secondary);
  border-color: var(--secondary);
  color: white;
}

.exam-search-wrapper {
  position: relative;
}

.predictive-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 20;
  max-height: 200px;
  overflow-y: auto;
}

.predictive-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.predictive-item:hover {
  background-color: var(--primary-light);
}

.selected-exam-card {
  background-color: var(--primary-light);
  border: 1.5px solid var(--primary-medium);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-top: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.file-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  padding: 30px 20px;
  text-align: center;
  cursor: pointer;
  background-color: var(--bg-card);
  transition: var(--transition);
}

.file-upload-zone:hover {
  border-color: var(--primary-medium);
  background-color: var(--primary-light);
}

.file-upload-zone i {
  font-size: 2.2rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.branch-card {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 16px;
}

.branch-card:hover {
  border-color: var(--primary-medium);
}

.branch-card.selected {
  border-color: var(--primary-medium);
  background-color: var(--primary-light);
}

.radio-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
}

.branch-card.selected .radio-circle {
  border-color: var(--primary-medium);
  background: radial-gradient(circle, var(--primary-medium) 40%, transparent 50%);
}

.calendar-carousel {
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 8px 0 16px;
}

.calendar-day-btn {
  flex: 1 1 33.33%;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 0;
  padding: 16px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}
.calendar-day-btn:last-child {
  border-right: 1px solid var(--border);
}

.calendar-day-btn .calendar-day-hours {
  color: var(--text-muted);
}

.calendar-day-btn.selected {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}
.calendar-day-btn.selected .calendar-day-hours {
  color: rgba(255, 255, 255, 0.8);
}

.time-slots-container h4 {
  font-size: 0.9rem;
  margin: 16px 0 8px;
  color: var(--text-muted);
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.slot-btn {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-btn:hover {
  border-color: var(--primary);
  background-color: var(--bg-app);
}

.slot-btn.selected {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white !important;
  box-shadow: 0 4px 12px rgba(11, 46, 122, 0.25);
}

.summary-box {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border);
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.preparation-alert {
  background-color: var(--color-warning-bg);
  border-left: 4px solid var(--color-warning);
  color: #92400e;
  padding: 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin-bottom: 20px;
}

.patient-profile-strip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: var(--primary);
  color: white;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.patient-info h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.result-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.exam-status-tag {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tag-listo {
  background-color: var(--color-success-bg);
  color: var(--color-success);
}

.tag-proceso {
  background-color: var(--color-warning-bg);
  color: var(--color-warning);
}

.tag-anulada {
  background-color: var(--color-danger-bg);
  color: var(--color-danger);
}

.tag-confirmada {
  background-color: var(--primary-light);
  color: var(--primary);
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border);
  border-top: 4px solid var(--primary-medium);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 20px auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Captcha Widget styling */
.captcha-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.captcha-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.captcha-checkbox {
  width: 24px;
  height: 24px;
  border: 2px solid var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.captcha-checkbox.verified {
  border-color: var(--color-success);
  background-color: var(--color-success);
  color: white;
}

.captcha-text {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-main);
  user-select: none;
}

.captcha-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.62rem;
  color: var(--text-muted);
  font-weight: 700;
}

.captcha-logo i {
  font-size: 1.1rem;
  color: var(--primary-medium);
  margin-bottom: 2px;
}

.text-center { text-align: center; }
.mb-3 { margin-bottom: 1rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.gap-2 { gap: 8px; }
.justify-between { justify-content: space-between; }
.align-items-center { align-items: center; }
.hidden { display: none !important; }

/* ERP Style: Esquinas cuadradas globales en toda la interfaz (excepto indicadores de progreso y widget de WhatsApp) */
*:not(.step-dot):not(.whatsapp-float-btn):not(.whatsapp-header-btn):not(.whatsapp-tooltip) {
  border-radius: 0px !important;
}

/* ==========================================================================
   WhatsApp Floating & Header Widget
   ========================================================================== */
.whatsapp-float-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 58px;
  height: 58px;
  background-color: #25d366;
  color: #ffffff !important;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(37, 211, 102, 0.45);
  z-index: 99999;
  text-decoration: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}

.whatsapp-float-btn:hover {
  transform: scale(1.1) translateY(-3px);
  background-color: #20ba5a;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.6);
  color: #ffffff !important;
}

.whatsapp-float-btn:active {
  transform: scale(0.95);
}

.whatsapp-float-btn svg {
  width: 32px;
  height: 32px;
  fill: #ffffff;
  display: block;
}

.whatsapp-tooltip {
  position: absolute;
  right: 70px;
  background: #0f172a;
  color: #ffffff;
  padding: 8px 14px;
  border-radius: 20px !important;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateX(10px);
  transition: all 0.25s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.whatsapp-tooltip::after {
  content: '';
  position: absolute;
  top: 50%;
  right: -6px;
  transform: translateY(-50%);
  border-width: 6px 0 6px 6px;
  border-style: solid;
  border-color: transparent transparent transparent #0f172a;
}

.whatsapp-float-btn:hover .whatsapp-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateX(0);
}

.whatsapp-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background-color: rgba(37, 211, 102, 0.12);
  color: #128c7e !important;
  border: 1px solid rgba(37, 211, 102, 0.35);
  padding: 7px 14px;
  border-radius: 20px !important;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.2s ease;
}

.whatsapp-header-btn svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
  flex-shrink: 0;
}

body.dark-mode .whatsapp-header-btn {
  background-color: rgba(37, 211, 102, 0.2);
  color: #25d366 !important;
  border-color: rgba(37, 211, 102, 0.45);
}

.whatsapp-header-btn:hover {
  background-color: #25d366;
  color: #ffffff !important;
  border-color: #25d366;
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(37, 211, 102, 0.35);
}

.whatsapp-header-btn:hover svg {
  fill: #ffffff;
}

@media (max-width: 640px) {
  .whatsapp-header-btn span {
    display: none;
  }
  .whatsapp-header-btn {
    padding: 8px;
    border-radius: 50% !important;
    width: 38px;
    height: 38px;
    justify-content: center;
  }
  .whatsapp-float-btn {
    bottom: 18px;
    right: 18px;
    width: 52px;
    height: 52px;
  }
  .whatsapp-float-btn svg {
    width: 28px;
    height: 28px;
  }
}

