/* ==========================================================================
   PREPARATION DESK - COMPREHENSIVE RESPONSIVE STYLESHEET
   Breakpoints:
   - 1200px (Desktop / Large Tablet)
   - 1024px (Tablet Landscape)
   - 768px  (Tablet Portrait / Mobile Header Breakpoint)
   - 480px  (Mobile Phones 320px - 480px)
   ========================================================================== */

/* --------------------------------------------------------------------------
   Global Overflow Containment
   -------------------------------------------------------------------------- */
html, body {
  overflow-x: hidden !important;
  width: 100% !important;
  max-width: 100vw !important;
  position: relative;
}

/* --------------------------------------------------------------------------
   1. Desktop / Laptop (Max-Width 1200px)
   -------------------------------------------------------------------------- */
@media (max-width: 1200px) {
  .hero-headline {
    font-size: 2.6rem;
  }

  .android-device-frame {
    width: 240px;
    height: 500px;
  }

  .apps-catalog-grid,
  .learning-tracks-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

/* --------------------------------------------------------------------------
   2. Tablet Landscape (Max-Width 1024px)
   -------------------------------------------------------------------------- */
@media (max-width: 1024px) {
  .hero-grid,
  .edtech-hero-grid,
  .app-detail-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .contact-layout-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 36px;
  }

  .contact-info-card,
  .contact-form-card {
    padding: 32px 26px;
  }

  .hero-content {
    max-width: 100%;
    text-align: center;
  }

  .hero-cta-group {
    justify-content: center;
  }

  .hero-trust-badges {
    justify-content: center;
  }

  .student-hero-wrapper {
    max-width: 640px;
    margin: 0 auto;
  }

  .apps-cards-grid,
  .pillars-grid,
  .app-features-grid,
  .apps-catalog-grid,
  .learning-tracks-grid,
  .student-stories-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .edtech-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .edtech-stat-item {
    border-right: none;
    background: #F8FAFC;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    padding: 14px;
  }

  .ecosystem-banner {
    grid-template-columns: 1fr;
    padding: 36px 28px;
    gap: 28px;
    text-align: center;
  }

  .ecosystem-banner div[style*="display: flex"] {
    justify-content: center;
  }

  .ecosystem-banner-img {
    max-width: 480px;
    margin: 0 auto;
  }

  .trust-strip-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  .footer-top-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 36px;
  }

  .footer-brand-col {
    grid-column: 1 / -1;
    padding-right: 0;
  }

  .legal-layout-grid {
    grid-template-columns: 1fr;
  }

  .legal-sidebar-nav {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   3. Tablet Portrait / Mobile Navigation Breakpoint (Max-Width 768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  :root {
    --header-height: 64px;
  }

  .container {
    padding-left: 20px;
    padding-right: 20px;
  }

  .site-header {
    height: var(--header-height);
  }

  .site-nav {
    display: none !important;
  }

  .mobile-menu-toggle {
    display: flex !important;
  }

  .brand-logo-img {
    height: 38px;
    width: auto;
  }

  .section-padding {
    padding: 52px 0;
  }

  .section-header {
    margin-bottom: 36px;
  }

  .section-title {
    font-size: 1.85rem;
  }

  .section-subtitle {
    font-size: 0.98rem;
  }

  /* Hero Section Mobile */
  .hero-section,
  .edtech-hero {
    padding: 36px 0 48px;
  }

  .hero-grid,
  .edtech-hero-grid {
    grid-template-columns: 1fr !important;
    gap: 32px;
  }

  .hero-headline {
    font-size: clamp(1.95rem, 6vw, 2.3rem);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
  }

  .hero-description {
    font-size: 1.02rem;
    line-height: 1.6;
    margin-bottom: 24px;
  }

  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .hero-cta-group .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    font-size: 0.95rem;
  }

  .hero-trust-badges {
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin-top: 24px;
  }

  .trust-badge-item {
    font-size: 0.85rem;
  }

  /* Student Hero Composition Mobile */
  .student-hero-wrapper {
    margin-top: 28px;
    width: 100%;
    max-width: 100%;
    position: relative;
    overflow: visible;
  }

  .student-hero-frame {
    border-radius: 20px;
    border-width: 3px;
  }

  .floating-stat-card {
    padding: 10px 14px;
    gap: 10px;
    border-radius: 14px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.15);
    max-width: calc(100% - 16px);
  }

  .floating-stat-top {
    top: -12px;
    right: 8px;
    left: auto;
  }

  .floating-stat-bottom {
    bottom: -12px;
    left: 8px;
    right: auto;
  }

  .floating-stat-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-radius: 10px;
  }

  .floating-stat-number {
    font-size: 0.98rem;
  }

  .floating-stat-label {
    font-size: 0.7rem;
  }

  /* Stats Bar Mobile */
  .edtech-stats-bar {
    padding: 18px 0;
  }

  .edtech-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .edtech-stat-item {
    padding: 12px 10px;
    gap: 12px;
  }

  .edtech-stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    border-radius: 10px;
  }

  .edtech-stat-value {
    font-size: 1.2rem;
  }

  .edtech-stat-text {
    font-size: 0.74rem;
  }

  /* Goal Selector */
  .goal-selector-nav {
    gap: 8px;
    margin-bottom: 28px;
  }

  .goal-pill-btn {
    padding: 8px 14px;
    font-size: 0.82rem;
    min-height: 40px;
  }

  /* App Cards & Catalog Grids */
  .apps-cards-grid,
  .apps-catalog-grid,
  .learning-tracks-grid,
  .student-stories-grid,
  .pillars-grid,
  .steps-grid,
  .app-features-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .app-catalog-card,
  .app-card {
    padding: 22px 18px;
    border-radius: 18px;
  }

  .app-card-title {
    font-size: 1.35rem;
  }

  .app-card-actions {
    flex-direction: column;
    gap: 10px;
  }

  .app-card-actions .btn {
    width: 100%;
    min-height: 44px;
    justify-content: center;
  }

  .trust-strip-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  /* Contact Layout 768px */
  .contact-layout-grid {
    gap: 28px;
  }

  .contact-info-card,
  .contact-form-card {
    padding: 24px 18px;
    border-radius: 18px;
  }

  .contact-info-item {
    gap: 14px;
    margin-bottom: 22px;
  }

  .google-sheets-badge-card {
    padding: 14px !important;
    gap: 12px !important;
  }

  #contact-submit-btn {
    padding: 14px 18px;
    font-size: 0.92rem;
    min-height: 48px;
  }

  /* Showcase Banner */
  .showcase-feature-banner {
    margin-top: 32px;
    border-radius: 16px;
  }

  .ecosystem-banner {
    padding: 30px 20px;
    border-radius: 20px;
    gap: 24px;
    text-align: center;
  }

  .ecosystem-banner h2 {
    font-size: 1.7rem !important;
    line-height: 1.25;
  }

  .ecosystem-banner p {
    font-size: 0.95rem !important;
    line-height: 1.6;
  }

  .ecosystem-banner div[style*="display: flex"] {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .ecosystem-banner .btn {
    width: 100%;
    min-height: 48px;
    justify-content: center;
  }

  /* App Detail Page */
  .app-hero-title {
    font-size: 2rem;
  }

  .app-hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 12px;
  }

  .app-hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .app-detail-meta-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Table Responsive Container */
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 16px 0;
    border-radius: 12px;
    border: 1px solid var(--color-border);
  }

  .table-responsive table {
    min-width: 500px;
    margin-bottom: 0;
  }

  /* Footer Mobile */
  .footer-top-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: center;
  }

  .footer-brand-col {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-links-list {
    align-items: center;
  }

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

  .footer-bottom-bar {
    flex-direction: column;
    text-align: center;
    gap: 12px;
  }

  /* Screenshot Carousel & Navigation Controls */
  .screenshot-carousel {
    position: relative;
    width: 100%;
    overflow: hidden;
    padding: 10px 0 16px;
  }

  .carousel-track {
    padding: 16px 0 28px;
    gap: 20px;
    width: max-content;
    margin: 0;
    touch-action: pan-y;
  }

  .carousel-slide {
    flex: 0 0 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .carousel-slide .android-device-frame {
    width: 240px;
    height: 500px;
    max-width: 100%;
  }

  .carousel-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 14px;
    padding: 6px 12px;
  }

  .carousel-btn {
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 9999px;
    background: #1E293B;
    color: #FFFFFF;
    border: 1px solid #475569;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    transition: transform 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
  }

  .carousel-btn:active {
    transform: scale(0.92);
    background: var(--color-royal);
    border-color: var(--color-royal);
  }

  .carousel-btn svg {
    width: 22px;
    height: 22px;
    pointer-events: none;
  }

  .carousel-dots {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .carousel-dot {
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .carousel-dot::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: #475569;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .carousel-dot.active::before {
    width: 22px;
    background: var(--color-royal);
  }
}

/* --------------------------------------------------------------------------
   4. Mobile Phones (Max-Width 480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  .container {
    padding-left: 16px;
    padding-right: 16px;
  }

  .brand-logo-img {
    height: 34px;
  }

  .hero-headline {
    font-size: 1.85rem;
    line-height: 1.2;
    word-break: break-word;
  }

  .section-title {
    font-size: 1.65rem;
  }

  .section-subtitle {
    font-size: 0.92rem;
  }

  .btn-lg {
    padding: 12px 20px;
    font-size: 0.92rem;
    width: 100%;
  }

  /* Floating Stat Badges on Small Screens */
  .floating-stat-card {
    padding: 8px 12px;
    gap: 8px;
    border-radius: 12px;
    max-width: calc(100% - 12px);
  }

  .floating-stat-top {
    top: -8px;
    right: 4px;
    left: auto;
  }

  .floating-stat-bottom {
    bottom: -8px;
    left: 4px;
    right: auto;
  }

  .floating-stat-icon {
    width: 32px;
    height: 32px;
    font-size: 1rem;
    border-radius: 8px;
  }

  .floating-stat-number {
    font-size: 0.9rem;
  }

  .floating-stat-label {
    font-size: 0.65rem;
  }

  /* Stats Bar Single Column on Smallest Phones */
  .edtech-stats-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .edtech-stat-item {
    padding: 12px 14px;
  }

  /* Goal Selector Buttons */
  .goal-selector-nav {
    flex-direction: column;
    width: 100%;
    align-items: stretch;
  }

  .goal-pill-btn {
    width: 100%;
    justify-content: center;
  }

  /* Apps Catalog Search & Tabs */
  .filter-tabs-wrapper {
    width: 100%;
    flex-direction: column;
    border-radius: 14px;
    padding: 6px;
    gap: 6px;
  }

  .filter-tab-btn {
    width: 100%;
    text-align: center;
    padding: 10px 14px;
    font-size: 0.85rem;
    min-height: 44px;
    justify-content: center;
  }

  /* Card Sizing */
  .app-catalog-card,
  .app-card {
    padding: 20px 14px;
  }

  .app-card-mockup-preview {
    margin: 16px -6px;
  }

  /* Contact Card Sizing & Details on Small Mobile */
  .contact-layout-grid {
    gap: 20px;
  }

  .contact-info-card,
  .contact-form-card {
    padding: 18px 14px;
    border-radius: 16px;
    min-width: 0;
  }

  .contact-info-item {
    gap: 12px;
    margin-bottom: 18px;
    min-width: 0;
  }

  .contact-icon-box {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    flex-shrink: 0;
  }

  .contact-icon-box svg {
    width: 18px;
    height: 18px;
  }

  .contact-item-title {
    font-size: 0.9rem;
  }

  .contact-item-text {
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .google-sheets-badge-card {
    padding: 12px 10px !important;
    gap: 10px !important;
  }

  .google-sheets-badge-card svg {
    width: 18px;
    height: 18px;
  }

  #sync-badge-title {
    font-size: 0.88rem !important;
  }

  #sync-badge-desc {
    font-size: 0.78rem !important;
    line-height: 1.45 !important;
  }

  .quick-category-chips {
    gap: 6px;
  }

  .quick-chip {
    padding: 5px 10px;
    font-size: 0.76rem;
  }

  #contact-submit-btn {
    padding: 12px 14px;
    font-size: 0.88rem;
    white-space: normal;
    min-height: 46px;
  }

  /* Form Elements Font Size (16px to stop iOS zoom) */
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px !important;
    padding: 12px 14px;
    min-height: 46px;
  }

  /* Screenshot Carousel on Small Mobile */
  .carousel-track {
    padding: 12px 0 24px;
    gap: 16px;
  }

  .carousel-slide {
    flex: 0 0 220px;
  }

  .carousel-slide .android-device-frame {
    width: 220px;
    height: 460px;
  }

  .carousel-controls {
    gap: 14px;
    margin-top: 10px;
    padding: 4px 8px;
  }

  .carousel-btn {
    width: 46px;
    height: 46px;
    min-width: 46px;
    min-height: 46px;
  }

  .carousel-btn svg {
    width: 20px;
    height: 20px;
  }

  .back-to-top-btn {
    bottom: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
  }
}

/* --------------------------------------------------------------------------
   5. Accessibility: Reduced Motion (prefers-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;
  }

  .hero-floating-phone,
  .floating-badge,
  .floating-stat-card,
  .pillar-card,
  .app-card,
  .app-catalog-card {
    transform: none !important;
    animation: none !important;
  }
}
