/* ========================================
   USER-CENTERED DESIGN ENHANCEMENTS
   Accessibility, Feedback & UX Improvements
   ======================================== */

/* ===== 1. ENHANCED FOCUS STATES ===== */

/* High visibility focus ring for all interactive elements */
:focus-visible {
  outline: 3px solid var(--ha-accent, #32373c);
  outline-offset: 3px;
  border-radius: var(--radius-sm, 8px);
}

/* Consistent focus for buttons */
.btn:focus-visible,
button:focus-visible {
  outline: 3px solid var(--ha-accent, #32373c);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(50, 55, 60, 0.15);
}

/* Links focus state */
a:focus-visible {
  outline: 3px solid var(--ha-accent, #32373c);
  outline-offset: 2px;
  text-decoration: underline;
}

/* Card focus state */
.service-card:focus-within,
.offer-card:focus-within,
.card:focus-within {
  outline: 3px solid var(--ha-accent, #32373c);
  outline-offset: 3px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

/* ===== 2. LOADING STATES ===== */

/* Loading spinner */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.7;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 3px solid rgba(154, 138, 123, 0.3);
  border-top-color: var(--ha-accent, #32373c);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Button loading state */
.btn.loading {
  color: transparent;
  min-width: 120px;
}

.btn.loading::after {
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-width: 2px;
  border-top-color: currentColor;
}

/* Page loading overlay */
.page-loading {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.3s ease;
}

.page-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.page-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(154, 138, 123, 0.2);
  border-top-color: var(--ha-accent, #32373c);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Skeleton loading for content */
.skeleton {
  background: linear-gradient(90deg,
    var(--ha-light, #f8f8f8) 25%,
    rgba(154, 138, 123, 0.1) 50%,
    var(--ha-light, #f8f8f8) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm, 8px);
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ===== 3. FORM VALIDATION & ERROR STATES ===== */

/* Form group styling */
.form-group {
  margin-bottom: 1.5rem;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--ha-primary, #7a6b5d);
}

.form-label.required::after {
  content: ' *';
  color: #dc3545;
}

/* Input base styling */
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  border: 2px solid rgba(154, 138, 123, 0.2);
  border-radius: var(--radius-sm, 8px);
  background: #fff;
  color: var(--text-dark, #000);
  transition: all 0.25s ease;
  -webkit-appearance: none;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
  border-color: rgba(154, 138, 123, 0.4);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--ha-accent, #32373c);
  box-shadow: 0 0 0 4px rgba(50, 55, 60, 0.1);
}

/* Success state */
.form-input.is-valid,
.form-select.is-valid,
.form-textarea.is-valid {
  border-color: #28a745;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%2328a745' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

/* Error state */
.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
  border-color: #dc3545;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23dc3545' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1rem;
  padding-right: 2.5rem;
}

/* Error/Help messages */
.form-error,
.form-help {
  display: block;
  margin-top: 0.375rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.form-error {
  color: #dc3545;
}

.form-error::before {
  content: '';
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.25rem;
  vertical-align: middle;
  background: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='%23dc3545' d='M8 0a8 8 0 100 16A8 8 0 008 0zm.93 12.412H7.07v-1.942h1.86v1.942zm-.121-2.892H7.2l-.26-5.58h2.12l-.26 5.58z'/%3e%3c/svg%3e") no-repeat center;
  background-size: contain;
}

.form-help {
  color: var(--ha-secondary, #5f6b73);
}

/* ===== 4. TOAST NOTIFICATIONS ===== */

.toast-container {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 90%;
  width: 400px;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: var(--radius-md, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  animation: toast-in 0.3s ease;
  border-left: 4px solid var(--ha-accent, #32373c);
}

.toast.toast-success {
  border-left-color: #28a745;
}

.toast.toast-error {
  border-left-color: #dc3545;
}

.toast.toast-warning {
  border-left-color: #ffc107;
}

.toast-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.toast-message {
  flex: 1;
  font-size: 0.9375rem;
  color: var(--text-dark, #000);
}

.toast-close {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--ha-secondary, #5f6b73);
  transition: color 0.2s ease;
}

.toast-close:hover {
  color: var(--text-dark, #000);
}

.toast.hiding {
  animation: toast-out 0.25s ease forwards;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(1rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(-0.5rem);
  }
}

/* ===== 5. IMPROVED TOUCH TARGETS ===== */

/* Ensure minimum 44x44px touch targets */
.mobile-menu-link,
.mobile-submenu-link,
.filter-btn,
.mobile-quick-treatment {
  min-height: 44px;
  display: flex;
  align-items: center;
}

/* Better tap areas for social links */
.social-links a {
  min-width: 44px;
  min-height: 44px;
}

/* Improve close button touch target */
.mobile-menu-close,
.search-close-btn {
  min-width: 44px;
  min-height: 44px;
}

/* ===== 6. REDUCED MOTION ===== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .floating-whatsapp-btn,
  .floating-book-btn {
    animation: none;
  }

  .scroll-indicator svg {
    animation: none;
  }
}

/* ===== 7. HIGH CONTRAST MODE ===== */

@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid #000;
  }

  .btn-secondary {
    border-width: 3px;
  }

  .service-card,
  .offer-card,
  .card {
    border-width: 2px;
    border-color: #000;
  }

  a {
    text-decoration: underline;
  }
}

/* ===== 8. PROGRESS INDICATORS ===== */

.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--ha-light, #f8f8f8);
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--ha-primary, #7a6b5d), var(--ha-accent, #32373c));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* Stepped progress */
.progress-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

.progress-steps::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--ha-light, #f8f8f8);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.progress-step-number {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--ha-light, #f8f8f8);
  border: 2px solid var(--ha-light, #f8f8f8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--ha-secondary, #5f6b73);
  transition: all 0.3s ease;
}

.progress-step.active .progress-step-number {
  background: var(--ha-accent, #32373c);
  border-color: var(--ha-accent, #32373c);
  color: #fff;
}

.progress-step.completed .progress-step-number {
  background: #28a745;
  border-color: #28a745;
  color: #fff;
}

.progress-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--ha-secondary, #5f6b73);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.progress-step.active .progress-step-label,
.progress-step.completed .progress-step-label {
  color: var(--ha-primary, #7a6b5d);
}

/* ===== 9. CONFIRMATION DIALOGS ===== */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10002;
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  padding: 1rem;
}

.dialog-overlay.active {
  opacity: 1;
  visibility: visible;
}

.dialog {
  background: #fff;
  border-radius: var(--radius-lg, 16px);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: scale(0.95);
  transition: transform 0.25s ease;
}

.dialog-overlay.active .dialog {
  transform: scale(1);
}

.dialog-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dialog-icon.warning {
  background: #fff3cd;
  color: #856404;
}

.dialog-icon.success {
  background: #d4edda;
  color: #155724;
}

.dialog-icon.error {
  background: #f8d7da;
  color: #721c24;
}

.dialog-title {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  color: var(--ha-primary, #7a6b5d);
}

.dialog-message {
  text-align: center;
  color: var(--text-dark, #000);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.dialog-actions .btn {
  flex: 1;
  max-width: 140px;
}

/* ===== 10. IMPROVED NAVIGATION ===== */

/* Active page indicator */
.nav-links a.active:not(.btn) {
  position: relative;
}

.nav-links a.active:not(.btn)::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  height: 3px;
  background: var(--ha-accent, #32373c);
  border-radius: 2px;
}

/* Breadcrumbs for better wayfinding */
.breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1rem 0;
  font-size: 0.875rem;
}

.breadcrumbs a {
  color: var(--ha-secondary, #5f6b73);
  text-decoration: none;
  transition: color 0.2s ease;
}

.breadcrumbs a:hover {
  color: var(--ha-accent, #32373c);
  text-decoration: underline;
}

.breadcrumbs-separator {
  color: var(--ha-secondary, #5f6b73);
  opacity: 0.5;
}

.breadcrumbs-current {
  color: var(--ha-primary, #7a6b5d);
  font-weight: 600;
}

/* ===== 11. BETTER PRICING DISPLAY ===== */

.price-display {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.price-current {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ha-accent, #32373c);
}

.price-original {
  font-size: 1.25rem;
  color: var(--ha-secondary, #5f6b73);
  text-decoration: line-through;
}

.price-savings {
  display: inline-block;
  background: #28a745;
  color: #fff;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.75rem;
  font-weight: 700;
}

/* ===== 12. FOOTER LINK IMPROVEMENTS ===== */

.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-links li {
  margin-bottom: 0.5rem;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: all 0.25s ease;
  display: inline-block;
  padding: 0.25rem 0;
}

.footer-links a:hover {
  color: #fff;
  transform: translateX(4px);
}

.footer-contact {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-contact li {
  margin-bottom: 0.5rem;
}

.footer-contact li.hours {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
}

.footer-note {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  opacity: 0.8;
}

/* ===== 13. ENHANCED MOBILE MENU ===== */

.mobile-menu-link {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.mobile-menu-link svg {
  opacity: 0.7;
  flex-shrink: 0;
}

.mobile-menu-link:hover svg,
.mobile-menu-link.active svg {
  opacity: 1;
}

/* Nav actions wrapper for mobile */
.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .nav-actions {
    display: none;
  }
}

/* ===== 14. IMPROVED BUTTONS ===== */

/* Button with icon */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-icon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Button sizes */
.btn-sm {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
}

.btn-lg {
  padding: 1.25rem 2.5rem;
  font-size: 1.125rem;
}

/* ===== 15. SCROLL TO TOP ===== */

.scroll-to-top {
  position: fixed;
  bottom: 6rem;
  right: 1.5rem;
  width: 44px;
  height: 44px;
  background: var(--ha-accent, #32373c);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem);
  transition: all 0.3s ease;
  z-index: 90;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--ha-primary, #7a6b5d);
  transform: translateY(-2px);
}

.scroll-to-top svg {
  width: 20px;
  height: 20px;
}

/* ===== 16. PRINT STYLES ===== */

@media print {
  .header,
  .footer,
  .floating-whatsapp-btn,
  .floating-book-btn,
  .scroll-to-top,
  .mobile-menu,
  .search-modal,
  .skip-link,
  .toast-container,
  .dialog-overlay {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
    background: #fff;
  }

  a {
    color: #000;
    text-decoration: underline;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 10pt;
    color: #666;
  }

  .btn {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
}
