/*
 * YourSelfAndMe - Comprehensive Responsive Fixes
 * Mobile-First Responsive Design for 100% Compatibility
 * Covers all pages: Landing, Auth, Booking, Dashboard, etc.
 */

/* ══════════════════════════════════════════════
   CRITICAL RESPONSIVE FOUNDATION FIXES
   ══════════════════════════════════════════════ */

/* Prevent horizontal scrolling globally */
html, body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Ensure all containers are responsive */
.container {
  width: min(100% - 20px, 1200px);
  margin: 0 auto;
  padding-left: 10px;
  padding-right: 10px;
  box-sizing: border-box;
}

/* Fix all fixed-width elements */
img, video, iframe, canvas, svg {
  max-width: 100%;
  height: auto;
  box-sizing: border-box;
}

/* Responsive tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1rem;
}

.table-responsive table {
  min-width: 600px;
  width: 100%;
}

/* ══════════════════════════════════════════════
   HEADER & NAVIGATION RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

/* Mobile navigation container fixes */
@media (max-width: 768px) {
  .site-header .header-container,
  .site-header .container {
    padding: 6px 14px;
    border-radius: 999px;
  }
}

@media (max-width: 480px) {
  .site-header .header-container,
  .site-header .container {
    padding: 6px 10px;
    border-radius: 999px;
  }
}

/* ══════════════════════════════════════════════
   HERO SECTION RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.hero {
  min-height: 70vh;
  padding: 2rem 0;
}

.hero .container {
  display: grid;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 992px) {
  .hero .container {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 991px) {
  .hero .container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-visual {
    order: 1;
  }

  .hero-content {
    order: 2;
  }

  .hero {
    min-height: 60vh;
  }
}

@media (max-width: 768px) {
  .hero {
    min-height: 50vh;
    padding: 1.5rem 0;
  }

  .hero h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem) !important;
  }

  .hero p {
    font-size: clamp(1rem, 3vw, 1.1rem) !important;
  }

  .hero-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }

  .hero-buttons .btn {
    width: 100%;
    min-width: auto;
  }
}

/* ══════════════════════════════════════════════
   CARD GRID RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.card-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (max-width: 480px) {
  .card-grid {
    gap: 0.75rem;
  }

  .card {
    padding: 1.5rem 1rem !important;
  }
}

/* ══════════════════════════════════════════════
   PRICING CARDS RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.pricing-card {
  position: relative;
}

.pricing-card.popular {
  transform: none !important;
  margin: 0 !important;
}

@media (max-width: 768px) {
  .pricing-card.popular {
    transform: none !important;
    scale: 1 !important;
    z-index: auto !important;
  }
}

.price {
  font-size: clamp(2rem, 5vw, 2.5rem) !important;
}

.price span {
  font-size: clamp(0.875rem, 2vw, 1rem) !important;
}

/* ══════════════════════════════════════════════
   FORM ELEMENTS RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.form-group {
  margin-bottom: 1rem;
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  font-size: clamp(0.875rem, 2vw, 1rem);
  box-sizing: border-box;
}

.form-row {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .form-control {
    padding: 14px 16px;
  }
}

@media (max-width: 480px) {
  .form-control {
    padding: 12px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
  }
}

/* ══════════════════════════════════════════════
   BUTTON RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 12px 24px;
  font-size: clamp(0.875rem, 2vw, 1rem);
  border-radius: 12px;
  min-height: 44px; /* Touch target size */
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .btn {
    padding: 14px 20px;
    font-size: 0.95rem;
  }
}

@media (max-width: 480px) {
  .btn {
    padding: 12px 16px;
    font-size: 0.9rem;
    min-height: 48px;
  }

  .btn-block,
  .hero-buttons .btn {
    width: 100% !important;
  }
}

/* ══════════════════════════════════════════════
   AUTH PAGES RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.auth-page {
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card,
.login-card {
  width: 100%;
  max-width: 480px;
  padding: 2rem;
  box-sizing: border-box;
}

@media (max-width: 768px) {
  .auth-page {
    padding: 0.75rem;
    align-items: flex-start;
    padding-top: 2rem;
  }

  .auth-card,
  .login-card {
    padding: 1.5rem;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .auth-page {
    padding: 0.5rem;
    padding-top: 1rem;
  }

  .auth-card,
  .login-card {
    padding: 1.25rem 1rem;
    border-radius: 16px;
  }
}

/* ══════════════════════════════════════════════
   BOOKING PAGE RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.booking-steps {
  display: flex;
  justify-content: space-between;
  margin-bottom: 2rem;
  position: relative;
}

@media (max-width: 480px) {
  .booking-steps {
    gap: 4px;
    margin-bottom: 1.5rem;
  }

  .booking-steps > div {
    width: 28px !important;
    height: 28px !important;
    font-size: 0.8rem !important;
  }
}

.booking-grid,
.form-row-2 {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

@media (max-width: 768px) {
  .booking-grid,
  .form-row-2 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* ══════════════════════════════════════════════
   SERVICES PAGE RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.service-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
  margin-bottom: 2rem;
}

.service-detail > div {
  flex: 1;
  min-width: 280px;
}

@media (max-width: 768px) {
  .service-detail {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }

  .service-detail > div {
    min-width: auto;
    width: 100%;
  }
}

/* ══════════════════════════════════════════════
   CONFIRMATION PAGE RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.booking-summary {
  background-color: var(--surface-color, rgba(255,255,255,0.05));
  padding: 1.5rem;
  border-radius: 16px;
  margin-bottom: 2rem;
}

.booking-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border-color, rgba(255,255,255,0.1));
}

.booking-summary-row:last-child {
  border-bottom: none;
}

@media (max-width: 480px) {
  .booking-summary {
    padding: 1rem;
  }

  .booking-summary-row {
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem 0;
  }

  .booking-summary-row span:first-child {
    font-weight: 600;
  }
}

/* Payment instructions responsive */
.payment-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.payment-item {
  background: var(--bg-color, #0a0a0f);
  padding: 1rem;
  border-radius: 12px;
}

/* ══════════════════════════════════════════════
   CONTACT PAGE RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.contact-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

@media (max-width: 768px) {
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
}

/* ══════════════════════════════════════════════
   FOOTER RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ══════════════════════════════════════════════
   DASHBOARD RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

.dashboard-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.dashboard-grid-3 {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 2fr 1fr;
}

@media (max-width: 992px) {
  .dashboard-grid,
  .dashboard-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Chat container responsive */
.chat-container {
  display: flex;
  height: calc(100vh - 200px);
  min-height: 500px;
  gap: 1rem;
}

.chat-sidebar {
  width: 300px;
  flex-shrink: 0;
}

.chat-window {
  flex: 1;
}

@media (max-width: 768px) {
  .chat-container {
    flex-direction: column;
    height: auto;
    min-height: 600px;
  }

  .chat-sidebar {
    width: 100%;
    max-height: 200px;
    order: 2;
  }

  .chat-window {
    height: 400px;
    order: 1;
  }
}

/* ══════════════════════════════════════════════
   TEXT & TYPOGRAPHY RESPONSIVE FIXES
   ══════════════════════════════════════════════ */

h1 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  line-height: 1.2;
}

h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  line-height: 1.3;
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.4;
}

p {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  line-height: 1.6;
}

/* ══════════════════════════════════════════════
   UTILITY CLASSES FOR RESPONSIVE DESIGN
   ══════════════════════════════════════════════ */

.d-none-mobile {
  display: block;
}

.d-block-mobile {
  display: none;
}

@media (max-width: 768px) {
  .d-none-mobile {
    display: none !important;
  }

  .d-block-mobile {
    display: block !important;
  }
}

.text-center-mobile {
  text-align: left;
}

@media (max-width: 768px) {
  .text-center-mobile {
    text-align: center !important;
  }
}

/* Spacing utilities */
.mb-responsive {
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .mb-responsive {
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 480px) {
  .mb-responsive {
    margin-bottom: 1rem;
  }
}

/* ══════════════════════════════════════════════
   ACCESSIBILITY & TOUCH IMPROVEMENTS
   ══════════════════════════════════════════════ */

/* Ensure buttons & controls are touch-friendly (NOT plain <a> tags - those break inline prose links) */
button,
.btn,
a[role="button"],
a.btn,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  min-height: 44px;
}

/* Form inputs need touch-friendly height */
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
select,
textarea {
  min-height: 44px;
}

@media (max-width: 480px) {
  button,
  .btn,
  a[role="button"],
  a.btn {
    min-height: 48px;
  }
}

/* Improve focus states for keyboard navigation */
button:focus,
.btn:focus,
a:focus,
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-gold, #d4af37);
  outline-offset: 2px;
}

/* ══════════════════════════════════════════════
   SPECIFIC FIXES FOR INLINE STYLES
   ══════════════════════════════════════════════ */

/* Override problematic inline styles */
[style*="width: 500px"],
[style*="width:500px"] {
  width: min(500px, 100%) !important;
}

[style*="max-width: 600px"],
[style*="max-width:600px"] {
  max-width: min(600px, 100%) !important;
}

[style*="max-width: 700px"],
[style*="max-width:700px"] {
  max-width: min(700px, 100%) !important;
}

[style*="max-width: 800px"],
[style*="max-width:800px"] {
  max-width: min(800px, 100%) !important;
}

/* Note: Inline grid-template-columns styles are not overridden here;
   components handle their own responsive collapse. */

/* ══════════════════════════════════════════════
   PRINT STYLES (BONUS)
   ══════════════════════════════════════════════ */

@media print {
  .site-header,
  .site-footer,
  .btn,
  button {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card {
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }
}

/* ══════════════════════════════════════════════
   REDUCED MOTION SUPPORT
   ══════════════════════════════════════════════ */

@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;
  }
}