/**
 * CSS SCOPÃ‰ pour Tebra Booking V3 - Style Tebra Exact
 * 
 * IMPORTANT: Tous les sÃ©lecteurs commencent par .tebra-booking-wrapper
 * pour Ã©viter les conflits avec le reste du site
 */

/* ============================================
   RESET DANS LE SCOPE
   ============================================ */
.tebra-booking-wrapper {
  box-sizing: border-box;
}

.tebra-booking-wrapper *,
.tebra-booking-wrapper *::before,
.tebra-booking-wrapper *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ============================================
   CONTAINER PRINCIPAL
   ============================================ */
.tebra-booking-wrapper {
  max-width: 1200px;
  margin: 40px auto;
  padding: 0 20px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: #333;
}

.tebra-booking-wrapper .tebra-main-title {
  font-size: 32px;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 20px;
}

/* ============================================
   NEW PATIENT CHECKBOX
   ============================================ */
.tebra-booking-wrapper .tebra-new-patient-check {
  margin-bottom: 40px;
}

.tebra-booking-wrapper .tebra-new-patient-check label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  cursor: pointer;
}

.tebra-booking-wrapper .tebra-new-patient-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #2d7a8e;
  cursor: pointer;
  margin: 0;
}

/* ============================================
   STEPS INDICATOR
   ============================================ */
.tebra-booking-wrapper .tebra-steps-indicator {
  display: flex;
  gap: 40px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid #e0e0e0;
}

.tebra-booking-wrapper .tebra-step {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #999;
  font-size: 14px;
}

.tebra-booking-wrapper .tebra-step.active {
  color: #2d7a8e;
  font-weight: 600;
}

.tebra-booking-wrapper .tebra-step.completed {
  color: #4caf50;
}

.tebra-booking-wrapper .step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e0e0e0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

.tebra-booking-wrapper .tebra-step.active .step-number {
  background: #2d7a8e;
}

.tebra-booking-wrapper .tebra-step.completed .step-number {
  background: #4caf50;
}

/* ============================================
   VISIT TYPE TABS
   ============================================ */
.tebra-booking-wrapper .tebra-visit-type-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 30px;
  max-width: 400px;
}

.tebra-booking-wrapper .tebra-tab {
  flex: 1;
  padding: 12px 24px;
  border: 1px solid #d0d0d0;
  background: #fff;
  color: #666;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
}

.tebra-booking-wrapper .tebra-tab:first-child {
  border-radius: 8px 0 0 8px;
}

.tebra-booking-wrapper .tebra-tab:last-child {
  border-radius: 0 8px 8px 0;
}

.tebra-booking-wrapper .tebra-tab:hover {
  background: #f9f9f9;
}

.tebra-booking-wrapper .tebra-tab.active {
  background: #2d7a8e;
  color: #fff;
  border-color: #2d7a8e;
}

/* ============================================
   APPOINTMENT GRID (Provider + Calendar)
   ============================================ */
.tebra-booking-wrapper .tebra-appointment-grid {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

/* ============================================
   PROVIDER CARD
   ============================================ */
.tebra-booking-wrapper .tebra-provider-card {
  background: #f9f9f9;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
}

.tebra-booking-wrapper .provider-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #2d7a8e;
  margin: 0 auto 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tebra-booking-wrapper .provider-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tebra-booking-wrapper .provider-info h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
  color: #1a1a1a;
}

.tebra-booking-wrapper .provider-info div {
  font-size: 14px;
  color: #666;
  text-align: center;
  margin-bottom: 8px;
  line-height: 1.6;
}

.tebra-booking-wrapper .provider-timezone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.tebra-booking-wrapper .provider-selector label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #1a1a1a;
}

.tebra-booking-wrapper .tebra-select {
  width: 100%;
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  cursor: pointer;
}

/* ============================================
   CALENDAR SECTION
   ============================================ */
.tebra-booking-wrapper .tebra-calendar-section {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  border: 1px solid #e0e0e0;
}

.tebra-booking-wrapper .tebra-week-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.tebra-booking-wrapper .week-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid #d0d0d0;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.tebra-booking-wrapper .week-nav-btn:hover {
  background: #f9f9f9;
  border-color: #2d7a8e;
}

.tebra-booking-wrapper .week-days {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  flex: 1;
}

.tebra-booking-wrapper .day-column {
  text-align: center;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
}

.tebra-booking-wrapper .day-column:hover {
  background: #f9f9f9;
  border-color: #e0e0e0;
}

.tebra-booking-wrapper .day-column.selected {
  background: #e6f4f7;
  border-color: #2d7a8e;
}

.tebra-booking-wrapper .day-name {
  font-size: 12px;
  font-weight: 600;
  color: #666;
  margin-bottom: 4px;
}

.tebra-booking-wrapper .day-date {
  font-size: 16px;
  font-weight: 600;
  color: #1a1a1a;
}

/* ============================================
   TIME SLOTS GRID
   ============================================ */
.tebra-booking-wrapper .tebra-time-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.tebra-booking-wrapper .time-slot {
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  background: white;
  transition: all 0.2s;
}

.tebra-booking-wrapper .time-slot:hover {
  border-color: #2d7a8e;
  background: #f9f9f9;
}

.tebra-booking-wrapper .time-slot.selected {
  background: #2d7a8e;
  color: white;
  border-color: #2d7a8e;
}

.tebra-booking-wrapper .time-slot.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tebra-booking-wrapper .time-slot.more {
  background: #f9f9f9;
  color: #2d7a8e;
  border-style: dashed;
}

/* ============================================
   SELECTED APPOINTMENT SUMMARY
   ============================================ */
.tebra-booking-wrapper .tebra-selected-appointment {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.tebra-booking-wrapper .appointment-details h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  color: #1a1a1a;
}

.tebra-booking-wrapper .appointment-details p {
  margin: 0;
  font-size: 14px;
  color: #666;
}

/* ============================================
   FORMULAIRES
   ============================================ */
.tebra-booking-wrapper .tebra-form-group {
  margin-bottom: 20px;
}

.tebra-booking-wrapper .tebra-form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: #1a1a1a;
}

.tebra-booking-wrapper .tebra-form-group input,
.tebra-booking-wrapper .tebra-form-group select,
.tebra-booking-wrapper .tebra-form-group textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.2s;
}

.tebra-booking-wrapper .tebra-form-group input:focus,
.tebra-booking-wrapper .tebra-form-group select:focus,
.tebra-booking-wrapper .tebra-form-group textarea:focus {
  outline: none;
  border-color: #2d7a8e;
  box-shadow: 0 0 0 3px rgba(45, 122, 142, 0.1);
}

.tebra-booking-wrapper .tebra-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.tebra-booking-wrapper .tebra-form-row {
  display: flex;
  flex-direction: row;
  gap: 20px;
}

/* ============================================
   INSURANCE SECTION
   ============================================ */
.tebra-booking-wrapper .tebra-insurance-check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tebra-booking-wrapper .tebra-insurance-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #2d7a8e;
}

.tebra-booking-wrapper #insurance-fields {
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  display: none;
}

.tebra-booking-wrapper #insurance-fields.active {
  display: block;
}

/* ============================================
   BOUTONS
   ============================================ */
.tebra-booking-wrapper .tebra-form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.tebra-booking-wrapper .tebra-btn {
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: none;
  font-family: inherit;
}

.tebra-booking-wrapper .tebra-btn-primary {
  background: #ff7a59;
  color: white;
  box-shadow: 0 2px 8px rgba(255, 122, 89, 0.3);
}

.tebra-booking-wrapper .tebra-btn-primary:hover {
  background: #ff6a49;
  box-shadow: 0 4px 12px rgba(255, 122, 89, 0.4);
  transform: translateY(-2px);
}

.tebra-booking-wrapper .tebra-btn-back {
  background: white;
  color: #666;
  border: 1px solid #d0d0d0;
}

.tebra-booking-wrapper .tebra-btn-back:hover {
  background: #f9f9f9;
  border-color: #999;
}

/* ============================================
   CONFIRMATION
   ============================================ */
.tebra-booking-wrapper .tebra-confirmation {
  text-align: center;
  padding: 40px 20px;
}

.tebra-booking-wrapper .tebra-confirmation-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #4caf50;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin: 0 auto 24px auto;
}

.tebra-booking-wrapper .tebra-confirmation h2 {
  font-size: 28px;
  margin: 0 0 16px 0;
  color: #1a1a1a;
}

.tebra-booking-wrapper .confirmation-box {
  background: #f9f9f9;
  padding: 24px;
  border-radius: 8px;
  margin: 24px auto;
  max-width: 600px;
  text-align: left;
}

.tebra-booking-wrapper .confirmation-item {
  margin-bottom: 12px;
  font-size: 16px;
}

/* ============================================
   LOADING & MESSAGES
   ============================================ */
.tebra-booking-wrapper .tebra-loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.tebra-booking-wrapper .tebra-loading-content {
  background: white;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
}

.tebra-booking-wrapper .loading-slots,
.tebra-booking-wrapper .no-slots,
.tebra-booking-wrapper .error-slots {
  padding: 40px;
  text-align: center;
  color: #666;
  font-size: 16px;
}

/* ============================================
   STEP VISIBILITY
   ============================================ */
.tebra-booking-wrapper .tebra-step-content {
  display: none;
}

.tebra-booking-wrapper .tebra-step-content.active {
  display: block;
}

/* ============================================
   HIDDEN INPUTS
   ============================================ */
.tebra-booking-wrapper input[type="hidden"] {
  display: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
  .tebra-booking-wrapper .tebra-appointment-grid {
    grid-template-columns: 1fr;
  }

  .tebra-booking-wrapper .tebra-time-slots {
    grid-template-columns: repeat(2, 1fr);
  }

  .tebra-booking-wrapper .week-days {
    grid-template-columns: repeat(3, 1fr);
  }

  .tebra-booking-wrapper .tebra-form-grid {
    grid-template-columns: 1fr;
  }

  .tebra-booking-wrapper .tebra-steps-indicator {
    flex-direction: column;
    gap: 12px;
  }
}

/* ===== PAYMENT SUMMARY ===== */
.tebra-payment-summary {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.tebra-payment-summary .summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0;
}

.tebra-payment-summary .summary-row:last-of-type {
  border-bottom: none;
}

.tebra-payment-summary .summary-total {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 2px solid #2d7a8e;
  font-size: 18px;
}

.tebra-payment-summary .summary-note {
  margin-top: 15px;
  color: #666;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tebra-payment-summary .summary-note .dashicons {
  color: #2d7a8e;
  flex-shrink: 0;
}

/* ===== SQUARE CARD FORM ===== */
.tebra-payment-form {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
}

.tebra-payment-form h4 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #1a1a1a;
}

#square-card-container {
  min-height: 100px;
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #fff;
}

/* Styles pour les erreurs Square */
#square-payment-errors {
  margin-top: 16px;
  padding: 12px;
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
  border-radius: 4px;
}

#square-payment-errors p {
  margin: 0;
}

/* ===== PAYMENT TERMS ===== */
.tebra-payment-terms {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  margin-bottom: 20px;
}

.tebra-payment-terms .tebra-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.tebra-payment-terms input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #2d7a8e;
  flex-shrink: 0;
}

.tebra-payment-terms a {
  color: #2d7a8e;
  text-decoration: underline;
}

.tebra-payment-terms a:hover {
  color: #1f5564;
}

/* ===== PROCESSING INDICATOR ===== */
.tebra-processing-indicator {
  text-align: center;
  padding: 30px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-top: 20px;
}

.tebra-processing-indicator .spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #2d7a8e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.tebra-processing-indicator p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

/* ===== PAYMENT BUTTON ===== */
#submit-payment {
  position: relative;
}

#submit-payment .dashicons {
  margin-right: 8px;
}

#submit-payment:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .tebra-payment-summary {
    padding: 16px;
  }

  .tebra-payment-form {
    padding: 16px;
  }

  .tebra-payment-summary .summary-total {
    font-size: 16px;
  }
}

/**
 * STYLES POUR STEP 4 PAYMENT (SQUARE)
 * À ajouter dans tebra-public.css
 */

/* ===== PAYMENT SUMMARY ===== */
.tebra-payment-summary {
  background: #f9f9f9;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.tebra-payment-summary .summary-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #e0e0e0;
}

.tebra-payment-summary .summary-row:last-of-type {
  border-bottom: none;
}

.tebra-payment-summary .summary-total {
  margin-top: 10px;
  padding-top: 15px;
  border-top: 2px solid #2d7a8e;
  font-size: 18px;
}

.tebra-payment-summary .summary-note {
  margin-top: 15px;
  color: #666;
  font-size: 14px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tebra-payment-summary .summary-note .dashicons {
  color: #2d7a8e;
  flex-shrink: 0;
}

/* ===== SQUARE CARD FORM ===== */
.tebra-payment-form {
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  margin-bottom: 20px;
  border: 1px solid #e0e0e0;
}

.tebra-payment-form h4 {
  margin-top: 0;
  margin-bottom: 16px;
  color: #1a1a1a;
}

#square-card-container {
  min-height: 100px;
  padding: 12px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #fff;
}

/* Styles pour les erreurs Square */
#square-payment-errors {
  margin-top: 16px;
  padding: 12px;
  background: #f8d7da;
  color: #721c24;
  border-left: 4px solid #dc3545;
  border-radius: 4px;
}

#square-payment-errors p {
  margin: 0;
}

/* ===== PAYMENT TERMS ===== */
.tebra-payment-terms {
  background: #fff;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e0e0e0;
  margin-bottom: 20px;
}

.tebra-payment-terms .tebra-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
}

.tebra-payment-terms input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #2d7a8e;
  flex-shrink: 0;
}

.tebra-payment-terms a {
  color: #2d7a8e;
  text-decoration: underline;
}

.tebra-payment-terms a:hover {
  color: #1f5564;
}

/* ===== PROCESSING INDICATOR ===== */
.tebra-processing-indicator {
  text-align: center;
  padding: 30px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-top: 20px;
}

.tebra-processing-indicator .spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #2d7a8e;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.tebra-processing-indicator p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

/* ===== PAYMENT BUTTON ===== */
#submit-payment {
  position: relative;
}

#submit-payment .dashicons {
  margin-right: 8px;
}

#submit-payment:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 600px) {
  .tebra-payment-summary {
    padding: 16px;
  }

  .tebra-payment-form {
    padding: 16px;
  }

  .tebra-payment-summary .summary-total {
    font-size: 16px;
  }
}
