/**
 * FleetOps Landing Pages - Responsive Styles v4.0
 *
 * Mobile-first responsive CSS with breakpoints:
 * - Mobile: < 768px (default styles)
 * - Tablet: 768px - 1024px
 * - Desktop: > 1024px
 *
 * Typography scaling and grid adjustments for all screen sizes.
 */

/* ============================================
 * MOBILE FIRST (Default styles for < 768px)
 * ============================================ */

/* Mobile-specific adjustments */
@media (max-width: 767px) {
  /* Typography scaling for mobile */
  h1, .heading-display {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  h2, .heading-section {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  h4, .heading-card {
    font-size: 1.125rem;
  }

  p, .lead {
    font-size: 1rem;
  }

  /* Dashboard preview mobile */
  .hero-dashboard-preview {
    max-width: 100%;
    margin-left: var(--space-4);
    margin-right: var(--space-4);
  }

  .fleet-stats {
    gap: var(--space-6);
  }

  .fleet-stat-value {
    font-size: var(--text-2xl);
  }

  .robot-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
  }

  .robot-svg {
    width: 40px;
    height: 30px;
  }

  .robot-id {
    font-size: 9px;
  }

  /* Section spacing mobile */
  .section {
    padding-top: var(--space-2xl);
    padding-bottom: var(--space-2xl);
  }

  .section-lg {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
  }

  /* Container padding mobile */
  .container {
    padding-left: var(--container-padding-mobile);
    padding-right: var(--container-padding-mobile);
  }

  /* Hero mobile adjustments */
  .section-hero {
    min-height: auto;
    padding-top: calc(var(--space-3xl) + 80px);
    padding-bottom: var(--space-2xl);
  }

  .section-hero-title {
    font-size: 1.75rem;
    margin-bottom: var(--space-md);
  }

  .section-hero-subtitle {
    font-size: 1rem;
    margin-bottom: var(--space-xl);
  }

  /* Hero metrics mobile */
  .hero-metrics {
    flex-direction: column;
    gap: var(--space-lg);
    padding: var(--space-lg);
  }

  .hero-metric {
    min-width: 100%;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--color-border-light);
  }

  .hero-metric:last-child {
    border-bottom: none;
  }

  .hero-metric-value {
    font-size: var(--font-size-metric-sm);
  }

  /* Button full width on mobile */
  .btn-mobile-block {
    width: 100%;
    justify-content: center;
  }

  /* Stack buttons vertically on mobile */
  .btn-group-mobile {
    flex-direction: column;
    width: 100%;
  }

  .btn-group-mobile .btn {
    width: 100%;
    border-radius: var(--border-radius-sm);
    margin-bottom: var(--space-sm);
  }

  .btn-group-mobile .btn:last-child {
    margin-bottom: 0;
  }

  /* Cards mobile */
  .card-feature {
    padding: var(--space-lg);
  }

  .card-feature-icon {
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--space-md);
  }

  .card-feature-icon svg {
    width: 1.5rem;
    height: 1.5rem;
  }

  /* Problem cards mobile */
  .card-problem {
    padding: var(--space-lg);
  }

  .card-problem-icon {
    width: 3rem;
    height: 3rem;
    margin-bottom: var(--space-md);
  }

  .problem-stat {
    font-size: var(--font-size-h5);
  }

  /* Solution steps mobile */
  .solution-steps {
    flex-direction: column;
  }

  .solution-step {
    margin-bottom: var(--space-xl);
  }

  .step-number {
    width: 3rem;
    height: 3rem;
    font-size: var(--font-size-h4);
    margin-bottom: var(--space-md);
  }

  /* Social proof mobile */
  .social-proof-metrics {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .social-proof-item {
    padding: var(--space-lg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .social-proof-item:last-child {
    border-bottom: none;
  }

  .social-proof-value {
    font-size: var(--font-size-metric);
  }

  /* Calculator mobile */
  .calculator-wrapper {
    grid-template-columns: 1fr;
    gap: var(--space-lg);
  }

  .calculator-inputs,
  .calculator-results {
    padding: var(--space-lg);
  }

  .calculator-result-value {
    font-size: var(--font-size-h4);
  }

  /* Contact block mobile */
  .contact-block {
    padding: var(--space-lg);
  }

  .contact-name {
    font-size: var(--font-size-h5);
    text-align: center;
  }

  .contact-info {
    width: 100%;
  }

  .contact-qr {
    width: 100%;
  }

  /* Footer mobile */
  .footer-grid {
    grid-template-columns: 1fr;
    text-align: center;
    gap: var(--space-xl);
  }

  .footer-brand-logo {
    justify-content: center;
  }

  .footer-links {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
  }

  /* Form adjustments mobile */
  .form-input,
  .form-textarea,
  .form-select {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Dashboard preview mobile */
  .hero-dashboard-preview {
    max-width: 100%;
    margin-left: var(--space-2);
    margin-right: var(--space-2);
  }

  .fleet-stats {
    gap: var(--space-4);
  }

  .fleet-stat-value {
    font-size: var(--text-xl);
  }

  .robot-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-2);
  }

  .robot-svg {
    width: 32px;
    height: 24px;
  }

  .robot-id {
    font-size: 7px;
  }

  /* Hide on mobile */
  .mobile-hidden {
    display: none !important;
  }

  /* Show on mobile only */
  .mobile-only {
    display: block !important;
  }

  /* Spacing adjustments */
  .space-y-mobile-xs > * + * { margin-top: var(--space-xs); }
  .space-y-mobile-sm > * + * { margin-top: var(--space-sm); }
  .space-y-mobile-md > * + * { margin-top: var(--space-md); }

  /* Text alignment mobile */
  .text-mobile-center { text-align: center; }
  .text-mobile-left { text-align: left; }

  /* Grid adjustments */
  .grid-mobile-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }

  /* Flex adjustments */
  .flex-mobile-col { flex-direction: column; }
  .flex-mobile-center { align-items: center; justify-content: center; }

  /* Reduce gaps on mobile */
  .gap-mobile-sm { gap: var(--space-sm); }
  .gap-mobile-md { gap: var(--space-md); }

  /* Padding adjustments */
  .p-mobile-sm { padding: var(--space-sm); }
  .p-mobile-md { padding: var(--space-md); }

  .px-mobile-sm {
    padding-left: var(--space-sm);
    padding-right: var(--space-sm);
  }

  .py-mobile-lg {
    padding-top: var(--space-lg);
    padding-bottom: var(--space-lg);
  }

  /* Calculator V3 mobile */
  .calculator-v3 {
    padding: var(--space-lg);
  }

  .calc-period-selector {
    flex-wrap: wrap;
    justify-content: center;
  }

  .calc-period-btn {
    padding: 5px 10px;
    font-size: 11px;
  }

  .calc-category-toggle-label {
    width: 100px;
  }

  .calc-breakdown-label {
    font-size: 10px;
  }

  .calc-breakdown-percent {
    font-size: 9px;
    padding: 1px 3px;
  }

  /* Скрываем tooltip на мобильных, показываем долгим нажатием */
  .calc-breakdown-item::after,
  .calc-breakdown-item::before {
    display: none;
  }

  .calc-breakdown-item:active::after,
  .calc-breakdown-item:active::before {
    display: block;
    opacity: 1;
    visibility: visible;
  }

  .calc-categories-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .calc-comparison {
    flex-direction: column;
    gap: var(--space-3);
  }

  .calc-comparison-divider {
    width: 100%;
    height: 1px;
  }

  .calc-oee {
    flex-direction: column;
    text-align: center;
  }

  .calc-cta .btn {
    min-width: 100%;
  }

  .calc-roi-content {
    flex-direction: column;
    gap: var(--space-4);
  }

  .calc-roi-divider {
    width: 80%;
    height: 1px;
  }

  .calc-insight {
    flex-direction: column;
    text-align: center;
  }

  .calc-insight-icon {
    margin: 0 auto;
  }
}

/* ============================================
 * SMALL MOBILE (< 480px)
 * ============================================ */

@media (max-width: 479px) {
  /* Extra small screens */
  h1, .section-hero-title {
    font-size: 1.5rem;
  }

  h2, .heading-section {
    font-size: 1.25rem;
  }

  .btn {
    padding: var(--space-sm) var(--space-lg);
    font-size: var(--font-size-body-sm);
  }

  .btn-lg {
    padding: var(--space-md) var(--space-xl);
    font-size: var(--font-size-body);
  }

  /* Hero extra small */
  .section-hero {
    padding-top: calc(var(--space-2xl) + 70px);
    padding-bottom: var(--space-2xl);
  }

  .section-hero-cta {
    gap: var(--space-sm);
  }

  .section-hero-cta .btn {
    width: 100%;
  }
}

/* ============================================
 * TABLET (768px - 1024px)
 * ============================================ */

@media (min-width: 768px) and (max-width: 1023px) {
  /* Typography scaling for tablet */
  h1, .heading-display {
    font-size: 2.5rem;
  }

  h2, .heading-section {
    font-size: 2rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  /* Section spacing tablet */
  .section {
    padding-top: var(--space-3xl);
    padding-bottom: var(--space-3xl);
  }

  /* Hero tablet */
  .section-hero {
    min-height: 85vh;
  }

  .section-hero-title {
    font-size: 2.5rem;
  }

  /* Hero metrics tablet */
  .hero-metrics {
    gap: var(--space-xl);
    padding: var(--space-lg);
  }

  /* Grid tablet */
  .grid-tablet-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-tablet-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* Solution steps tablet */
  .solution-steps {
    flex-direction: row;
    gap: var(--space-lg);
  }

  .step-number {
    width: 3.5rem;
    height: 3.5rem;
    font-size: var(--font-size-h4);
  }

  /* Social proof tablet */
  .social-proof-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Hide on tablet */
  .tablet-hidden {
    display: none !important;
  }

  /* Show on tablet only */
  .tablet-only {
    display: block !important;
  }

  /* Footer tablet */
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
  }
}

/* ============================================
 * DESKTOP (>= 1024px)
 * ============================================ */

@media (min-width: 1024px) {
  /* Typography scaling for desktop */
  h1, .heading-display {
    font-size: 3rem;
  }

  h2, .heading-section {
    font-size: 2.25rem;
  }

  h3 {
    font-size: 1.5rem;
  }

  /* Section spacing desktop */
  .section {
    padding-top: var(--space-4xl);
    padding-bottom: var(--space-4xl);
  }

  .section-lg {
    padding-top: calc(var(--space-4xl) * 1.5);
    padding-bottom: calc(var(--space-4xl) * 1.5);
  }

  /* Hero desktop */
  .section-hero {
    min-height: 100vh;
  }

  .section-hero-title {
    font-size: var(--font-size-display);
  }

  .section-hero-subtitle {
    font-size: var(--font-size-body-xl);
  }

  /* Grid desktop */
  .grid-desktop-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-desktop-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-desktop-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }

  /* Calculator desktop */
  .calculator-wrapper {
    grid-template-columns: 1fr 1fr;
  }

  /* Social proof desktop */
  .social-proof-metrics {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Hide on desktop */
  .desktop-hidden {
    display: none !important;
  }

  /* Show on desktop only */
  .desktop-only {
    display: block !important;
  }

  /* Footer desktop */
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

/* ============================================
 * LARGE DESKTOP (>= 1280px)
 * ============================================ */

@media (min-width: 1280px) {
  /* Typography scaling for large desktop */
  h1, .heading-display {
    font-size: 3.5rem;
  }

  h2, .heading-section {
    font-size: 2.5rem;
  }

  /* Hero large desktop */
  .section-hero-title {
    font-size: var(--font-size-display);
  }

  /* Container max width adjustment */
  .container {
    max-width: var(--container-xl);
  }

  .container-wide {
    max-width: var(--container-2xl);
  }
}

/* ============================================
 * EXTRA LARGE DESKTOP (>= 1536px)
 * ============================================ */

@media (min-width: 1536px) {
  h1, .heading-display {
    font-size: 4rem;
  }

  .section-hero-title {
    font-size: var(--font-size-display-xl);
  }

  .container {
    max-width: var(--container-2xl);
  }
}

/* ============================================
 * PRINT STYLES
 * ============================================ */

@media print {
  /* Hide non-essential elements */
  .header,
  .nav-mobile,
  .nav-toggle,
  .btn,
  .section-cta,
  .footer-social,
  .spinner,
  .skeleton {
    display: none !important;
  }

  /* Reset backgrounds */
  body {
    background: white;
    color: black;
  }

  .section,
  .section-hero,
  .section-bg,
  .section-bg-dark,
  .section-social-proof {
    background: white !important;
    color: black !important;
    padding: 1rem 0;
  }

  /* Ensure text is readable */
  h1, h2, h3, h4, h5, h6, p, a {
    color: black !important;
  }

  /* Show links */
  a[href]::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
    color: #666;
  }

  /* Page breaks */
  .section {
    page-break-inside: avoid;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }
}

/* ============================================
 * LANDSCAPE ORIENTATION ADJUSTMENTS
 * ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
  /* Short landscape screens (mobile landscape) */
  .section-hero {
    min-height: auto;
    padding-top: var(--space-xl);
    padding-bottom: var(--space-xl);
  }

  .section-hero-title {
    font-size: 1.5rem;
    margin-bottom: var(--space-sm);
  }

  .section-hero-subtitle {
    font-size: 0.875rem;
    margin-bottom: var(--space-md);
  }

  .hero-metrics {
    flex-direction: row;
    padding: var(--space-md);
    gap: var(--space-lg);
  }
}

/* ============================================
 * HIGH DPI / RETINA DISPLAYS
 * ============================================ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Sharper borders on high DPI */
  .card,
  .btn,
  .form-input,
  .form-select,
  .form-textarea {
    border-width: 0.5px;
  }
}

/* ============================================
 * TOUCH DEVICE ADJUSTMENTS
 * ============================================ */

@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn {
    min-height: 44px;
    min-width: 44px;
  }

  .nav-desktop-link {
    padding: var(--space-sm) var(--space-md);
  }

  .form-input,
  .form-select,
  .form-textarea {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on iOS */
  }

  /* Remove hover effects that don't work well on touch */
  .card:hover {
    transform: none;
  }

  .btn:hover {
    transform: none;
  }

  /* Active states instead of hover */
  .btn:active:not(:disabled) {
    transform: scale(0.98);
  }

  .card:active {
    transform: scale(0.99);
  }
}

/* ============================================
 * REDUCED MOTION PREFERENCES
 * ============================================ */

@media (prefers-reduced-motion: reduce) {
  /* Already handled in reset.css, but additional component-specific rules */
  .card:hover {
    transform: none;
  }

  .spinner {
    animation: none;
  }

  .skeleton {
    animation: none;
    background: var(--color-bg-tertiary);
  }

  /* Disable hero background patterns animation */
  .section-hero::before,
  .section-hero::after {
    animation: none;
  }
}

/* ============================================
 * DARK MODE SUPPORT (optional future use)
 * ============================================ */

@media (prefers-color-scheme: dark) {
  /*
   * FleetOps uses light theme by default.
   * Dark mode styles can be enabled here in the future.
   * Currently disabled to maintain brand consistency.
   */
}

/* Force dark mode class (for future use) */
.dark-mode {
  --color-bg-primary: #1A1A1A;
  --color-bg-secondary: #2D3748;
  --color-bg-tertiary: #4A5568;
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #E2E8F0;
  --color-text-muted: #A0AEC0;
  --color-border-light: #4A5568;
  --color-border-default: #718096;
}

/* ============================================
 * CONTAINER QUERIES (Modern browsers)
 * ============================================ */

/* For components that need container-based responsiveness */
@supports (container-type: inline-size) {
  .card-container {
    container-type: inline-size;
  }

  @container (min-width: 300px) {
    .card-feature {
      padding: var(--space-xl);
    }
  }

  @container (min-width: 400px) {
    .card-feature {
      flex-direction: row;
      text-align: left;
      gap: var(--space-lg);
    }

    .card-feature-icon {
      margin: 0;
      flex-shrink: 0;
    }
  }
}
