/* ==========================================================================
   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: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --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: 8px;
  overflow-x: auto;
  padding: 8px 0 16px;
}

.calendar-day-btn {
  flex: 0 0 calc(25% - 6px);
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-day-btn.selected {
  background-color: var(--primary);
  border-color: var(--primary);
  color: white;
}

.time-slots-container h4 {
  font-size: 0.9rem;
  margin: 16px 0 8px;
  color: var(--text-muted);
}

.slots-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.slot-btn {
  background-color: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.slot-btn.selected {
  background-color: var(--primary-medium);
  border-color: var(--primary-medium);
  color: white;
}

.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; }
.hidden { display: none !important; }
