/**
 * Mobile-only adaptation for desktop sections.
 * ALL selectors are scoped to .mobile-device .desktop-only — desktop is never touched.
 */

@media (max-width: 1023px) {
  .mobile-device .page-sections-order {
    display: flex;
    flex-direction: column;
  }
  .mobile-device .page-sections-order .mobile-first-screen { order: 1; }
  .mobile-device .page-sections-order .desktop-only { order: 2; }
  .mobile-device .page-sections-order .mobile-only { order: 3; }

  .mobile-device .desktop-only .pricing-comparison-section {
    display: block !important;
  }
  .mobile-device .desktop-only .container {
    max-width: 100%;
    padding: 0 12px;
  }

  /* ========== SCREEN 2: SAMPLE REPORT — чёрный фон как на десктопе (variant-dark) ========== */
  .mobile-device .desktop-only .sample-report-section {
    padding: 32px 16px 40px;
    background: linear-gradient(135deg, #1a1a1a 0%, #0a0a0a 100%) !important;
    background-color: #0a0a0a !important;
  }
  .mobile-device .desktop-only .sample-report-container {
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto 420px auto auto auto !important;
    gap: 16px 0 !important;
    padding: 0 12px !important;
    max-width: 100% !important;
    align-items: center !important;
    justify-items: center !important;
    text-align: center !important;
  }
  .mobile-device .desktop-only .sample-report-arrow {
    display: none !important;
  }
  .mobile-device .desktop-only .sample-report-text,
  .mobile-device .desktop-only .sample-report-content,
  .mobile-device .desktop-only .sample-report-action {
    display: contents;
  }
  .mobile-device .desktop-only .sample-report-title {
    grid-column: 1 !important;
    grid-row: 1 !important;
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.15;
    margin: 0;
    text-align: center;
  }
  .mobile-device .desktop-only .sample-report-subtitle {
    grid-column: 1 !important;
    grid-row: 2 !important;
    font-size: 16px;
    color: #9ca3af;
    margin: 0;
    line-height: 1.5;
    text-align: center;
  }
  .mobile-device .desktop-only .vin-pdfstack__chips {
    display: none !important;
  }
  .mobile-device .desktop-only .pdf-stack-column {
    grid-column: 1 !important;
    grid-row: 3 !important;
    width: 280px !important;
    min-width: 280px !important;
    max-width: 280px !important;
    height: 400px !important;
    min-height: 400px !important;
    padding: 0 !important;
    justify-self: center;
    display: flex !important;
    justify-content: center;
    align-items: center;
    flex-shrink: 0 !important;
  }
  .mobile-device .desktop-only .pdf-stack-column .vin-pdfstack {
    width: 280px !important;
    height: 400px !important;
    flex-shrink: 0 !important;
  }
  .mobile-device .desktop-only .pdf-stack-column .vin-pdfstack__stage {
    width: 280px !important;
    height: 400px !important;
    flex-shrink: 0 !important;
  }
  .mobile-device .desktop-only .pdf-stack-column .vin-pdfstack__stack {
    width: 280px !important;
    min-width: 280px !important;
    height: 380px !important;
    min-height: 380px !important;
    max-height: 380px !important;
    flex-shrink: 0 !important;
    transform: none !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
    box-sizing: border-box !important;
  }
  .mobile-device .desktop-only .pdf-stack-column .vin-pdfstack__page {
    width: 280px !important;
    height: 380px !important;
    min-width: 280px !important;
    min-height: 380px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    position: absolute !important;
    inset: 0 !important;
    padding: 0 !important;
    transition: none !important;
    transform: none !important;
  }
  .mobile-device .desktop-only .pdf-stack-column .vin-pdfstack__page.is-active {
    opacity: 1 !important;
    transform: none !important;
    z-index: 1 !important;
  }
  /* Канвас на мобилке рендерится в JS с scale 0.45 (~268×379) — без transform, просто по центру */
  .mobile-device .desktop-only .pdf-stack-column .vin-pdfstack__canvas {
    position: absolute !important;
    left: 6px !important;
    top: 0 !important;
    transform: none !important;
    display: block !important;
  }
  .mobile-device .desktop-only .sample-report-chips-wrapper {
    grid-column: 1 !important;
    grid-row: 4 !important;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 8px;
  }
  .mobile-device .desktop-only .sample-report-chips-wrapper .vin-pdfstack__nav-pill {
    flex-shrink: 0;
  }
  .mobile-device .desktop-only .sample-report-disclaimer {
    grid-column: 1 !important;
    grid-row: 5 !important;
    font-size: 14px;
    color: #6b7280;
    line-height: 1.6;
    text-align: center;
    padding: 0 8px;
    margin: 0;
    max-width: 320px;
    justify-self: center;
  }
  .mobile-device .desktop-only .sample-report-btn {
    grid-column: 1 !important;
    grid-row: 6 !important;
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%) !important;
    color: #000000 !important;
    border: none;
    border-radius: 999px;
    box-shadow: 0 4px 20px rgba(252, 211, 77, 0.4) !important;
    max-width: 280px;
  }
  .mobile-device .desktop-only .sample-report-btn:hover,
  .mobile-device .desktop-only .sample-report-btn:active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #000000 !important;
    box-shadow: 0 8px 32px rgba(252, 211, 77, 0.5) !important;
  }

  /* ========== SCREEN 3: VIN DECODER — same logic & visual as desktop (left=decoder+bubbles+btn, right=car) → 1 col ========== */
  /* Desktop: dark gradient, instruction, VIN code pill + diagram bubbles below, conversion box, button; right = car image. */
  .mobile-device .desktop-only .vin-decoder-section {
    min-height: auto !important;
    padding: 32px 16px 40px !important;
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 50%, #0f1419 100%) !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    grid-template-rows: auto auto auto auto auto auto !important;
    gap: 16px 0 !important;
    align-items: center !important;
    justify-items: center !important;
    text-align: center !important;
  }
  .mobile-device .desktop-only .vin-decoder-wrapper {
    display: contents;
    min-height: 0;
    gap: 0;
  }
  .mobile-device .desktop-only .vin-decoder-container {
    display: contents;
    max-width: none;
    flex: none;
  }
  .mobile-device .desktop-only .vin-instruction {
    grid-column: 1 !important;
    grid-row: 1 !important;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 8px;
    text-align: center;
  }
  .mobile-device .desktop-only .try-vin-text {
    margin: 0 0 12px;
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.5px;
    margin: 0 0 12px;
    text-align: center;
  }
  .mobile-device .desktop-only .try-vin-text .vin-decoder-text {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  .mobile-device .desktop-only .vin-code-display {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    gap: 2px 4px;
    padding: 12px 20px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: 50px;
    width: auto;
    margin: 0 auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  }
  .mobile-device .desktop-only .vin-char {
    color: #e5e7eb;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
  }
  .mobile-device .desktop-only .vin-display-wrapper {
    display: flex !important;
    flex-direction: column !important;
    grid-column: 1 !important;
    grid-row: 2 !important;
    position: relative;
    width: 100%;
    margin-bottom: 20px !important;
  }
  .mobile-device .desktop-only .try-vin-text {
    order: -1;
  }
  .mobile-device .desktop-only .vin-code-wrapper {
    display: block !important;
    position: relative !important;
    width: 100%;
    padding-bottom: 0 !important;
  }
  .mobile-device .desktop-only .vin-diagram {
    position: relative !important;
    margin-top: 12px !important;
    width: 100% !important;
    padding: 0 !important;
    min-height: 72px !important;
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
  }
  /* Hide original 6 boxes on mobile — JS shows one .mobile-decoder-bubble inside slot */
  .mobile-device .desktop-only .vin-diagram .info-box {
    display: none !important;
  }
  /* Слот: по центру экрана, один бабл внутри */
  .mobile-device .desktop-only .vin-diagram .mobile-decoder-bubble-slot {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    width: 100% !important;
    padding: 0 16px !important;
    box-sizing: border-box !important;
  }
  .mobile-device .desktop-only .vin-diagram .mobile-decoder-bubble {
    display: none;
    width: 100%;
    max-width: min(320px, calc(100vw - 32px));
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.5;
    box-sizing: border-box;
    border-radius: 12px;
    border: 2px solid rgba(59, 130, 246, 0.35);
    background: rgba(0, 0, 0, 0.95);
    color: #e2e8f0;
    text-align: center;
    flex-shrink: 0;
  }
  .mobile-device .desktop-only .vin-diagram .mobile-decoder-bubble.is-visible {
    display: block !important;
  }
  .mobile-device .desktop-only .vin-diagram .info-box::before,
  .mobile-device .desktop-only .vin-diagram .info-box::after {
    display: none !important;
  }
  .mobile-device .desktop-only .vin-decoder-image {
    grid-column: 1 !important;
    grid-row: 3 !important;
    max-width: 100%;
    width: 100%;
    padding: 0;
    margin-top: 0 !important;
  }
  .mobile-device .desktop-only .vin-decoder-image img {
    width: 100%;
    max-width: 420px !important;
    height: auto;
    margin: 0 auto;
    display: block;
    transform: none;
  }
  .mobile-device .desktop-only .vin-conversion-text {
    display: none;
  }
  .mobile-device .desktop-only .vin-check-button-wrapper {
    grid-column: 1 !important;
    grid-row: 4 !important;
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .mobile-device .desktop-only .vin-check-btn {
    padding: 16px 40px;
    font-size: 16px;
    font-weight: 700;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #000;
    border: none;
    border-radius: 50px;
    box-shadow: 0 10px 30px rgba(251, 191, 36, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* ========== PRICING — compact table, neat padding ========== */
  .mobile-device .desktop-only .pricing-comparison-section {
    padding: 20px 0 28px;
  }
  .mobile-device .desktop-only .pricing-comparison-section .container {
    padding: 0 12px;
  }
  .mobile-device .desktop-only .pricing-header {
    margin-bottom: 12px;
  }
  .mobile-device .desktop-only .pricing-header h2 {
    font-size: 20px;
  }
  .mobile-device .desktop-only .pricing-header p {
    font-size: 13px;
  }
  .mobile-device .desktop-only .price-offer-card {
    margin-bottom: 14px;
    padding: 10px 14px;
  }
  .mobile-device .desktop-only .price-offer-content {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .mobile-device .desktop-only .price-cta-btn {
    font-size: 13px;
    padding: 10px 18px;
  }
  .mobile-device .desktop-only .comparison-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  .mobile-device .desktop-only .comparison-table {
    min-width: 300px;
    border-radius: 16px;
  }
  .mobile-device .desktop-only .comparison-header,
  .mobile-device .desktop-only .comparison-row,
  .mobile-device .desktop-only .comparison-footer {
    grid-template-columns: 1.4fr 1fr 1fr 1fr;
  }
  .mobile-device .desktop-only .comparison-cell {
    padding: 6px 8px;
    font-size: 11px;
  }
  .mobile-device .desktop-only .comparison-cell-feature {
    font-size: 11px;
  }
  .mobile-device .desktop-only .provider-name {
    font-size: 10px;
  }
  .mobile-device .desktop-only .provider-price {
    font-size: 11px;
  }
  .mobile-device .desktop-only .comparison-cta-btn {
    font-size: 11px;
    padding: 8px 12px;
  }

  /* ========== REVIEWS — compact ========== */
  .mobile-device .desktop-only .reviews-section {
    padding: 24px 0 32px;
  }
  .mobile-device .desktop-only .reviews-container {
    padding: 0 12px;
  }
  .mobile-device .desktop-only .reviews-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .mobile-device .desktop-only .reviews-right {
    order: -1;
  }
  .mobile-device .desktop-only .reviews-header h2 {
    font-size: 20px;
  }
  .mobile-device .desktop-only .reviews-header p {
    font-size: 13px;
  }
  .mobile-device .desktop-only .rating-summary {
    grid-template-columns: 1fr;
    padding: 12px;
    border-radius: 16px;
  }
  .mobile-device .desktop-only .reviews-filter {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  .mobile-device .desktop-only .review-card {
    padding: 12px;
  }
  .mobile-device .desktop-only .review-form-card {
    padding: 16px;
  }
  .mobile-device .desktop-only .submit-review-btn {
    width: 100%;
    padding: 12px 20px;
  }
}
