/* ============================================
   AGENDORA BOOKING — Modern App Design
   Mobile-first, PWA-ready
   ============================================ */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: #F8FAFC;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Override Bootstrap container on mobile */
#main {
  max-width: 100% !important;
  padding: 0 !important;
  min-height: 100vh;
}

.row.wrapper {
  min-height: 100vh;
  margin: 0;
  justify-content: center;
  align-items: flex-start;
  background: #F8FAFC;
}

/* ============================================
   APP SHELL
   ============================================ */
#book-appointment-wizard {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 0;
  background: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ============================================
   HEADER
   ============================================ */
#header {
  background: var(--company-color, #2563EB);
  padding: 14px 18px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.15);
}

#company-name {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  float: none !important;
  min-width: 0 !important;
  text-align: left !important;
  line-height: 1.3 !important;
  font-size: 16px !important;
  font-weight: 600 !important;
  margin-bottom: 10px;
}

#company-name #company-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  display: block !important;
  float: none !important;
  margin: 0 !important;
  background: rgba(255, 255, 255, 0.2);
}

#company-name > span {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.display-booking-selection {
  display: none !important;
}

/* ── Progress bar ── */
#steps {
  display: flex !important;
  gap: 4px;
  width: 100% !important;
  float: none !important;
  margin: 0 0 -1px !important;
  padding: 0;
  overflow: visible;
}

.book-step {
  flex: 1 !important;
  height: 3px !important;
  background: rgba(255, 255, 255, 0.25) !important;
  border-radius: 2px 2px 0 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  width: auto !important;
  float: none !important;
  cursor: default !important;
  filter: none !important;
  transition: background 0.35s ease !important;
  position: relative !important;
}

.book-step strong {
  display: none !important;
}

.book-step.active-step,
.active-step {
  background: #fff !important;
  height: 3px !important;
  width: auto !important;
  flex: 1 !important;
  float: none !important;
  padding: 0 !important;
  margin: 0 !important;
  margin-top: 0 !important;
  border-radius: 2px 2px 0 0 !important;
  filter: none !important;
}

/* ============================================
   WIZARD FRAMES
   ============================================ */
.wizard-frame {
  flex: 1;
  padding: 22px 16px 96px;
  min-height: calc(100vh - 76px);
}

.frame-container {
  min-height: 0;
}

.frame-title {
  font-size: 21px !important;
  font-weight: 700 !important;
  color: #0F172A !important;
  margin-bottom: 18px !important;
  letter-spacing: -0.4px;
  text-align: left !important;
}

/* ============================================
   SERVICE CARDS  (Step 1)
   ============================================ */

/* Hide the raw select — visual cards drive it */
#select-service {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.service-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 6px;
}

.service-category-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94A3B8;
  margin: 14px 0 6px;
}

.service-card {
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 14px 14px 14px 16px;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 14px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.service-card:active {
  transform: scale(0.985);
}

.service-card.selected {
  border-color: var(--company-color, #2563EB);
  background: color-mix(in srgb, var(--company-color, #2563EB) 6%, #fff);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--company-color, #2563EB) 12%, transparent);
}

.service-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--company-color, #2563EB), color-mix(in srgb, var(--company-color, #2563EB) 75%, #fff));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  flex-shrink: 0;
}

.service-card-info {
  flex: 1;
  min-width: 0;
}

.service-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 3px;
  line-height: 1.3;
}

.service-card-meta {
  font-size: 13px;
  color: #64748B;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.service-card-meta-chip {
  display: flex;
  align-items: center;
  gap: 3px;
}

.service-card-price {
  font-weight: 600;
  color: #0F172A;
}

.service-card-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #CBD5E1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  flex-shrink: 0;
  color: transparent;
  font-size: 10px;
}

.service-card.selected .service-card-check {
  background: var(--company-color, #2563EB);
  border-color: var(--company-color, #2563EB);
  color: #fff;
}

/* ============================================
   PROVIDER SECTION (Step 1)
   ============================================ */
#branch-selection-section .card,
.branch-card {
  border-radius: 14px !important;
  border: 1.5px solid #E2E8F0 !important;
  transition: border-color 0.18s ease, background 0.18s ease !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

.branch-card.border-primary {
  border-color: var(--company-color, #2563EB) !important;
  background: color-mix(in srgb, var(--company-color, #2563EB) 6%, #fff) !important;
}

#service-description {
  font-size: 13px;
  color: #64748B;
  line-height: 1.5;
  padding: 8px 0;
  overflow-y: auto;
  max-height: 120px;
}

/* ============================================
   TIME STEP  (Step 2)
   ============================================ */

/* Calendar */
#wizard-frame-2 #select-time {
  max-width: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
}

#wizard-frame-2 #select-time.select-time-full {
  max-width: 100% !important;
}

.flatpickr-calendar {
  border-radius: 18px !important;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07) !important;
  border: 1.5px solid #E2E8F0 !important;
  font-family: inherit !important;
  margin: 0 auto 20px !important;
}

.flatpickr-day.selected,
.flatpickr-day.selected:hover,
.flatpickr-day.selected:focus {
  background: var(--company-color, #2563EB) !important;
  border-color: var(--company-color, #2563EB) !important;
  color: #fff !important;
}

.flatpickr-day.today:not(.selected) {
  border-color: var(--company-color, #2563EB) !important;
  color: var(--company-color, #2563EB) !important;
}

.flatpickr-day:hover:not(.flatpickr-disabled):not(.selected) {
  background: color-mix(in srgb, var(--company-color, #2563EB) 10%, #fff) !important;
  border-color: color-mix(in srgb, var(--company-color, #2563EB) 30%, transparent) !important;
}

.flatpickr-months .flatpickr-prev-month:hover svg,
.flatpickr-months .flatpickr-next-month:hover svg {
  fill: var(--company-color, #2563EB) !important;
}

/* Time slot chips */
.available-hour {
  min-width: 78px !important;
  height: 42px !important;
  border-radius: 22px !important;
  border: 1.5px solid #E2E8F0 !important;
  background: #fff !important;
  color: #334155 !important;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  padding: 0 14px !important;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease !important;
  -webkit-tap-highlight-color: transparent !important;
  white-space: nowrap !important;
}

.available-hour:hover:not(.selected-hour) {
  border-color: var(--company-color, #2563EB) !important;
  color: var(--company-color, #2563EB) !important;
  background: color-mix(in srgb, var(--company-color, #2563EB) 5%, #fff) !important;
}

.available-hour.selected-hour {
  background: var(--company-color, #2563EB) !important;
  border-color: var(--company-color, #2563EB) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--company-color, #2563EB) 40%, transparent) !important;
}

/* Provider-slot group cards */
.provider-slot-group {
  border-radius: 16px !important;
  margin-bottom: 14px !important;
  border: 1.5px solid #E2E8F0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  overflow: hidden !important;
}

.provider-slot-group > div:first-child {
  background: #F8FAFC !important;
  padding: 11px 14px !important;
}

.provider-slot-group > div:last-child {
  padding: 12px 14px !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch !important;
}

.provider-slot-group.border-success {
  border-color: #16A34A !important;
  border-width: 2px !important;
}

/* ============================================
   INFO STEP  (Step 3)
   ============================================ */
#wizard-frame-3 .field-col {
  max-width: 100% !important;
  flex: 0 0 100% !important;
  padding: 0;
}

.form-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #475569 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  margin-bottom: 5px !important;
}

.form-control {
  border-radius: 12px !important;
  border: 1.5px solid #E2E8F0 !important;
  padding: 11px 14px !important;
  font-size: 15px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
  height: auto !important;
  color: #0F172A;
}

.form-control:focus {
  border-color: var(--company-color, #2563EB) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--company-color, #2563EB) 12%, transparent) !important;
  outline: none !important;
}

.form-select {
  border-radius: 12px !important;
  border: 1.5px solid #E2E8F0 !important;
  padding: 11px 14px !important;
  font-size: 15px !important;
  height: auto !important;
}

.form-select:focus {
  border-color: var(--company-color, #2563EB) !important;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--company-color, #2563EB) 12%, transparent) !important;
}

.input-group .form-select.country-code-select {
  border-radius: 12px 0 0 12px !important;
}

.input-group .form-control.phone-input {
  border-radius: 0 12px 12px 0 !important;
}

/* ============================================
   CONFIRMATION STEP  (Step 4)
   ============================================ */
#appointment-details,
#customer-details {
  background: #F8FAFC !important;
  border-radius: 16px !important;
  padding: 18px !important;
  text-align: left !important;
  margin-bottom: 12px;
}

#appointment-details p,
#customer-details p {
  font-size: 14.5px !important;
  line-height: 1.65 !important;
  color: #334155 !important;
  margin-bottom: 6px !important;
}

#appointment-details p strong,
#customer-details p strong {
  color: #0F172A;
}

/* ============================================
   COMMAND BUTTONS  — fixed bottom bar
   ============================================ */
.command-buttons {
  position: fixed !important;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 14px max(16px, env(safe-area-inset-bottom));
  display: flex !important;
  gap: 10px;
  border-top: 1px solid #E2E8F0;
  z-index: 200;
  text-align: unset;
  margin: 0 !important;
}

.button-next {
  flex: 1 !important;
  height: 50px !important;
  border-radius: 14px !important;
  background: var(--company-color, #2563EB) !important;
  border: none !important;
  color: #fff !important;
  font-size: 15.5px !important;
  font-weight: 600 !important;
  letter-spacing: -0.2px !important;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--company-color, #2563EB) 40%, transparent) !important;
  transition: opacity 0.15s ease, transform 0.12s ease !important;
  -webkit-tap-highlight-color: transparent !important;
  min-width: unset !important;
  margin: 0 !important;
}

.button-next:active {
  opacity: 0.85;
  transform: scale(0.97);
}

.button-back {
  height: 50px !important;
  border-radius: 14px !important;
  border: 1.5px solid #E2E8F0 !important;
  background: #fff !important;
  color: #64748B !important;
  font-size: 14.5px !important;
  padding: 0 18px !important;
  min-width: unset !important;
  margin: 0 !important;
  transition: background 0.15s ease !important;
  -webkit-tap-highlight-color: transparent !important;
}

.button-back:hover {
  background: #F8FAFC !important;
}

/* Confirmation submit button */
#book-appointment-form {
  display: contents !important;
}

#book-appointment-submit {
  flex: 1 !important;
  height: 50px !important;
  border-radius: 14px !important;
  background: var(--company-color, #2563EB) !important;
  border: none !important;
  color: #fff !important;
  font-size: 15.5px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 16px color-mix(in srgb, var(--company-color, #2563EB) 40%, transparent) !important;
  min-width: unset !important;
  margin: 0 !important;
  width: 100% !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Captcha */
.captcha-title { float: none; margin: 0 0 8px; }
.captcha-image { float: none; display: block; margin-bottom: 10px; border-radius: 8px; }
.captcha-text  { margin-bottom: 10px; }

/* ============================================
   FOOTER / MISC
   ============================================ */
#frame-footer,
#book-appointment-wizard #frame-footer {
  padding: 14px;
  text-align: center;
  border-top: 1px solid #E2E8F0;
  font-size: 12.5px;
  color: #94A3B8;
}

.backend-link {
  font-size: 13px;
  color: #94A3B8;
  text-align: center;
  display: block;
  margin: 12px auto;
}

/* PWA install button */
.pwa-install-btn {
  position: fixed;
  bottom: 80px;
  right: 14px;
  z-index: 300;
  border-radius: 24px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

/* ============================================
   BOOKING MAIN TABS  (Club)
   ============================================ */
.booking-main-tabs {
  background: #fff;
  border-bottom: 1px solid #E2E8F0 !important;
}

.booking-main-tabs .nav-link {
  border-radius: 0;
  color: #64748B;
  font-size: 14px;
  padding: 10px 16px;
  border: none !important;
  border-bottom: 2px solid transparent !important;
}

.booking-main-tabs .nav-link.active {
  color: var(--company-color, #2563EB);
  border-bottom-color: var(--company-color, #2563EB) !important;
  background: transparent;
}

/* ============================================
   DESKTOP — centered card
   ============================================ */
@media (min-width: 768px) {
  #main {
    background: #EFF4FB !important;
  }

  .row.wrapper {
    background: #EFF4FB;
    align-items: flex-start;
    padding: 32px 0 64px;
    min-height: 100vh;
  }

  #book-appointment-wizard {
    border-radius: 24px;
    min-height: auto;
    overflow: hidden;
    box-shadow: 0 8px 48px rgba(0, 0, 0, 0.10);
  }

  .wizard-frame {
    padding: 26px 32px 96px;
  }

  .service-cards-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .command-buttons {
    position: sticky !important;
    transform: none !important;
    left: auto !important;
    border-radius: 0 0 24px 24px !important;
  }

  #wizard-frame-4 .frame-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  #appointment-details,
  #customer-details {
    margin-bottom: 0 !important;
  }
}

@media (max-width: 767px) {
  #wizard-frame-4 .frame-content {
    max-width: 100% !important;
  }
}

/* ============================================
   BOTTOM NAV — Instagram-style tab bar
   ============================================ */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 520px;
  height: 70px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid #E2E8F0;
  display: flex;
  align-items: stretch;
  z-index: 350;
}

.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: none;
  background: transparent;
  color: #94A3B8;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.3px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.15s ease;
  padding: 4px 4px 6px;
}

.nav-tab i {
  font-size: 24px;
  transition: color 0.15s ease, transform 0.15s ease;
  line-height: 1;
}

.nav-tab.active {
  color: var(--company-color, #2563EB);
}

.nav-tab.active i {
  transform: scale(1.12);
}

.nav-tab:active i {
  transform: scale(0.9);
}

/* ============================================
   TAB VISIBILITY — CSS-driven panel switching
   ============================================ */
#panel-inicio,
#panel-perfil {
  display: none;
}

#book-appointment-wizard.tab-inicio #panel-inicio { display: block; }
#book-appointment-wizard.tab-perfil  #panel-perfil  { display: block; }

#book-appointment-wizard.tab-inicio #wizard-content,
#book-appointment-wizard.tab-perfil  #wizard-content { display: none; }

#book-appointment-wizard.tab-inicio #steps,
#book-appointment-wizard.tab-perfil  #steps {
  opacity: 0 !important;
  pointer-events: none !important;
}

#book-appointment-wizard.tab-inicio #frame-footer,
#book-appointment-wizard.tab-perfil  #frame-footer { display: none !important; }

/* ============================================
   APP PANELS — shared container
   ============================================ */
.app-panel {
  flex: 1;
  padding: 22px 16px 96px;
  min-height: calc(100vh - 76px - 60px);
}

/* ============================================
   INICIO PANEL
   ============================================ */
.panel-inicio-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inicio-hero {
  text-align: center;
  padding: 20px 0 8px;
}

.inicio-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--company-color, #2563EB);
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
}

#inicio-avatar-initials {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.inicio-greeting {
  font-size: 24px !important;
  font-weight: 700 !important;
  color: #0F172A !important;
  margin: 0 0 4px !important;
  letter-spacing: -0.5px;
}

.inicio-greeting-sub {
  font-size: 14px;
  color: #64748B;
  margin: 0;
}

.inicio-company-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F8FAFC;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 14px 16px;
}

.inicio-company-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: #E2E8F0;
}

.inicio-company-name {
  font-size: 16px;
  font-weight: 600;
  color: #0F172A;
  flex: 1;
}

.inicio-action-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  border: 1.5px solid #E2E8F0;
  border-radius: 16px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.inicio-action-card:active {
  transform: scale(0.985);
  background: #F8FAFC;
}

.inicio-action-icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 19px;
  flex-shrink: 0;
}

.inicio-action-info {
  flex: 1;
  min-width: 0;
}

.inicio-action-title {
  font-size: 15px;
  font-weight: 600;
  color: #0F172A;
  margin-bottom: 2px;
}

.inicio-action-desc {
  font-size: 12.5px;
  color: #64748B;
}

.inicio-action-arrow {
  color: #CBD5E1;
  font-size: 13px;
}

/* ============================================
   PERFIL PANEL
   ============================================ */
.panel-perfil-content {
  display: flex;
  flex-direction: column;
}

.perfil-hero {
  text-align: center;
  padding: 20px 0 20px;
}

.perfil-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: #64748B;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 26px;
}

#perfil-avatar-initials {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
}

.perfil-title {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #0F172A !important;
  margin: 0 0 4px !important;
}

.perfil-subtitle {
  font-size: 13px;
  color: #94A3B8;
  margin: 0;
}

.perfil-form {
  margin-top: 8px;
}

.perfil-note {
  text-align: center;
  font-size: 11.5px;
  color: #94A3B8;
  margin-top: 18px;
}

/* ============================================
   COMMAND BUTTONS — sit above bottom nav on mobile
   ============================================ */
.command-buttons {
  bottom: 60px !important;
}

/* On desktop: sticky (position irrelevant) — reset */
@media (min-width: 768px) {
  #bottom-nav {
    position: sticky;
    bottom: 0;
    left: auto;
    transform: none;
    max-width: 100%;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
  }
  .command-buttons {
    bottom: 0 !important;
  }
  .pwa-install-btn {
    bottom: 80px !important;
  }
}

@media (max-width: 767px) {
  .pwa-install-btn {
    bottom: 140px !important;
  }
}
