/* ============================================
   pH Prescription Website - Responsive Styles
   ============================================ */

/* Mobile First Approach
   Base styles are mobile, then scale up
   ============================================ */

/* ============================================
   Mobile (<768px) - Base Styles
   ============================================ */

/* Mobile Navigation */
@media (max-width: 767px) {
  .menu-toggle {
    display: block;
    font-size: 1.75rem;
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
  }

  .nav {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background-color: var(--color-secondary);
    box-shadow: var(--box-shadow);
    padding: var(--spacing-sm) 0;
    gap: 0;
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .nav.active {
    display: flex;
  }

  .nav > li {
    border-bottom: 1px solid var(--color-border);
  }

  .nav > li:last-child {
    border-bottom: none;
  }

  .nav a {
    padding: 0.875rem var(--spacing-md);
    border-radius: 0;
    border-bottom: none;
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .nav li:last-child a {
    border-bottom: none;
  }

  /* Mobile Dropdown Menus */
  .nav .has-dropdown .dropdown-menu {
    position: static;
    display: none !important;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    min-width: 0;
    opacity: 1;
    visibility: visible;
    transform: none;
    background: var(--color-background);
  }

  .nav .has-dropdown.mobile-open .dropdown-menu {
    display: block !important;
  }

  .nav .dropdown-menu li a {
    padding-left: calc(var(--spacing-md) + var(--spacing-sm));
    font-size: var(--font-size-small);
    background: var(--color-background);
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  /* CTA button in mobile menu */
  .nav > li > a.btn {
    margin: var(--spacing-sm) var(--spacing-md);
    justify-content: center;
  }

  /* Header - hide top bar on mobile to save space */
  .header-top {
    display: none;
  }

  .logo img {
    height: 44px;
  }

  /* Hero */
  .hero h1 {
    font-size: 1.75rem;
    line-height: 1.3;
  }

  .hero p {
    font-size: var(--font-size-base);
    line-height: 1.5;
  }

  .hero-actions {
    flex-direction: column;
    gap: var(--spacing-sm);
  }

  .hero-actions .btn {
    width: 100%;
    min-width: 0;
    padding: 0.875rem var(--spacing-md);
  }

  /* Hero Video - reduce height, hide video to save data */
  .hero.hero-with-video {
    min-height: auto;
    padding: var(--spacing-xxl) 0;
  }

  .hero-video,
  .section-bg-video {
    display: none;
  }

  .hero.hero-with-video {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-teal) 100%);
  }

  .section-video-bg {
    background: linear-gradient(135deg, #1a3a4a 0%, #00808b 100%);
  }

  /* Typography */
  :root {
    --font-size-h1: 1.75rem;
    --font-size-h2: 1.5rem;
    --font-size-h3: 1.25rem;
    --spacing-xxl: 2rem;
    --spacing-xl: 1.5rem;
  }

  /* Section header h2 - override hardcoded 2.5rem from components.css */
  .section-header h2 {
    font-size: 1.5rem;
  }

  .section-header p {
    font-size: 1rem;
  }

  /* Grid Layouts */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--spacing-md) !important;
  }

  .product-cards {
    grid-template-columns: 1fr;
  }

  /* Product Cards on Mobile */
  .product-card-image {
    height: 200px;
  }

  .card-header-image {
    height: 150px;
  }

  .card-header-title {
    font-size: 1.4rem;
  }

  /* Forms */
  .form-row {
    grid-template-columns: 1fr;
  }

  /* Stats - 2 columns on mobile for compact display */
  .stats {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-sm);
  }

  .stat-number {
    font-size: 2rem;
  }

  .stat-label {
    font-size: var(--font-size-small);
  }

  /* Footer */
  .footer-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }

  .footer-section {
    text-align: center;
  }

  .social-links {
    justify-content: center;
  }

  /* Section Spacing */
  .section {
    padding: var(--spacing-xl) 0;
  }

  /* Container Padding */
  :root {
    --container-padding: 1rem;
  }

  /* Cards */
  .card-content {
    padding: var(--spacing-sm);
  }

  .product-card {
    padding: var(--spacing-md);
  }

  /* Testimonials */
  .testimonial-author {
    flex-direction: column;
    text-align: center;
  }

  .testimonial-content {
    font-size: var(--font-size-base);
  }

  /* CTA Section */
  .cta-section h2 {
    font-size: var(--font-size-h2);
  }

  .cta-section p {
    font-size: var(--font-size-base);
  }

  /* Solution Cards */
  .solution-card-image {
    height: 180px;
  }

  .solution-card-overlay h3 {
    font-size: 1.25rem;
  }

  .solution-card-overlay p {
    font-size: var(--font-size-small);
  }

  .solution-card-body {
    padding: var(--spacing-sm);
  }

  .solution-card-body .btn {
    width: 100%;
    text-align: center;
  }

  /* Ensure all interactive elements are touch-friendly (44px minimum) */
  .btn {
    min-height: 44px;
    padding: 0.75rem var(--spacing-md);
  }

  .btn-large {
    padding: 0.875rem var(--spacing-lg);
  }

  /* Prevent horizontal overflow */
  body {
    overflow-x: hidden;
  }

  /* Safe area support for notched devices */
  .site-header {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  .site-footer {
    padding-bottom: calc(var(--spacing-md) + env(safe-area-inset-bottom));
  }

  .container {
    padding-left: max(var(--container-padding), env(safe-area-inset-left));
    padding-right: max(var(--container-padding), env(safe-area-inset-right));
  }

  /* Announcement bar */
  .announcement-bar {
    font-size: 0.8rem;
  }

  .announcement-content {
    animation-duration: 20s;
  }

  /* Expert/team photos */
  .expert-photo {
    width: 100px;
    height: 100px;
  }

  .team-photo {
    width: 150px;
    height: 150px;
  }

  /* Process steps */
  .step-number {
    width: 48px;
    height: 48px;
    font-size: 1.25rem;
  }

  /* Featured system price */
  .featured-system-price {
    flex-direction: column;
    gap: var(--spacing-xs);
    text-align: center;
  }

  /* Smooth text rendering */
  * {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ============================================
   Small mobile (<400px)
   ============================================ */

@media (max-width: 399px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .stat-number {
    font-size: 1.75rem;
  }

  .hero-actions .btn {
    font-size: var(--font-size-small);
  }
}

/* ============================================
   Tablet (768px - 1024px)
   ============================================ */

@media (min-width: 768px) and (max-width: 1024px) {
  /* Grid Layouts */
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
  }

  .product-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Product Cards on Tablet */
  .product-card-image {
    height: 220px;
  }

  .card-header-image {
    height: 170px;
  }

  .card-header-title {
    font-size: 1.6rem;
  }

  /* Hero */
  .hero h1 {
    font-size: 2.5rem;
  }

  /* Container */
  :root {
    --container-padding: 2rem;
  }

  /* Navigation */
  .nav {
    gap: var(--spacing-sm);
  }

  .nav a {
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: var(--font-size-small);
  }

  /* Section header */
  .section-header h2 {
    font-size: 2rem;
  }
}

/* ============================================
   Desktop (>1024px)
   ============================================ */

@media (min-width: 1025px) {
  /* Large screens - default styles apply */

  /* Optional: Extra large screens */
  @media (min-width: 1400px) {
    :root {
      --container-width: 1320px;
    }
  }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
  .site-header,
  .site-footer,
  .hero-actions,
  .cta-section,
  .menu-toggle,
  .nav {
    display: none;
  }

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

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

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }

  img {
    max-width: 100%;
    page-break-inside: avoid;
  }

  .section {
    page-break-inside: avoid;
  }
}

/* ============================================
   Accessibility & Reduced Motion
   ============================================ */

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

  .section-bg-video,
  .hero-video {
    display: none;
  }

  .section-video-bg {
    background: linear-gradient(135deg, #1a3a4a 0%, #00808b 100%);
  }
}

/* ============================================
   High Contrast Mode
   ============================================ */

@media (prefers-contrast: high) {
  :root {
    --color-primary: #006570;
    --color-text: #000;
    --color-border: #000;
  }

  .btn {
    border-width: 3px;
  }

  a {
    text-decoration: underline;
  }
}

/* ============================================
   Dark Mode Support (Optional)
   ============================================ */

@media (prefers-color-scheme: dark) {
  /* Uncomment to enable dark mode */
  /*
  :root {
    --color-secondary: #1a1a1a;
    --color-text: #e0e0e0;
    --color-text-light: #b0b0b0;
    --color-background: #2a2a2a;
    --color-border: #404040;
  }

  .card,
  .site-header {
    background-color: #2a2a2a;
  }

  .form-input,
  .form-select,
  .form-textarea {
    background-color: #2a2a2a;
    color: var(--color-text);
  }
  */
}

/* ============================================
   Landscape Orientation
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: var(--spacing-lg) 0;
  }

  .hero.hero-with-video {
    min-height: auto;
  }

  .section {
    padding: var(--spacing-lg) 0;
  }
}

/* ============================================
   Featured Sections - Mobile Responsive
   ============================================ */

@media (max-width: 767px) {
  /* Book Feature */
  .book-feature {
    padding: var(--spacing-lg);
  }

  .book-feature-content {
    grid-template-columns: 1fr;
    gap: var(--spacing-lg);
  }

  .book-feature-title {
    font-size: 1.8rem;
  }

  .book-feature-subtitle {
    font-size: 1.5rem;
  }

  .book-feature-description {
    font-size: 1rem;
  }

  .book-cover-3d {
    transform: perspective(1000px) rotateY(0deg);
    max-width: 80%;
  }

  /* Featured System */
  .featured-system-header h2 {
    font-size: 1.5rem;
  }

  .featured-system-tagline {
    font-size: 1.2rem;
  }

  .featured-system-subtitle {
    font-size: 1rem;
  }

  .featured-system-content {
    grid-template-columns: 1fr;
    padding: var(--spacing-lg);
  }

  .featured-system-description {
    font-size: 1rem;
  }

  .price-amount {
    font-size: 1.5rem;
  }

  /* Replenishment Program */
  .replenishment-header h2 {
    font-size: 1.8rem;
  }

  .replenishment-header h3 {
    font-size: 1.3rem;
    padding: var(--spacing-xs) var(--spacing-md);
  }

  .replenishment-content {
    grid-template-columns: 1fr;
    padding: var(--spacing-lg);
  }

  .replenishment-image {
    display: none;
  }

  .replenishment-image:first-child {
    display: block;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  /* Book Feature */
  .book-feature-content {
    grid-template-columns: 1fr;
  }

  .book-feature-image {
    order: -1;
  }

  /* Featured System */
  .featured-system-content {
    grid-template-columns: 1fr;
  }

  /* Replenishment Program */
  .replenishment-content {
    grid-template-columns: 1fr;
  }

  .replenishment-image:last-child {
    display: none;
  }
}
