/* ===============================================
   RESPONSIVE DESIGN ENHANCEMENTS
   Ensures optimal display across all devices
   =============================================== */

/* ================ Base Responsive Rules ================ */
* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
}

html, body {
  min-width: 0 !important;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
}

/* ================ Touch-Friendly Buttons (min 44x44px) ================ */
.btn,
.mobile-menu-toggle,
.nav-link,
.pill,
button,
input[type="submit"],
input[type="button"],
input[type="file"] + label,
a.btn,
.cta-btn {
  min-width: 44px;
  padding: 12px 20px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
}

/* Ensure form inputs are also touch-friendly */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea
 {
  min-height: 44px;
  padding: 12px 16px;
  font-size: 16px; /* Prevents zoom on iOS */
  -webkit-appearance: none;
  appearance: none;
}

/* ================ Tablet Breakpoint (768px - 1023px) ================ */
@media (max-width: 1023px) and (min-width: 768px) {
  .container {
    max-width: 720px;
    padding-inline: 20px;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-sub {
    font-size: 1.1rem;
  }

  .two-col {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .tools-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }

  .tool-interface {
    grid-template-columns: 1fr;
  }
  
  /* Show mobile menu toggle on tablets too */
  .mobile-menu-toggle {
    display: block !important;
  }
  
  .nav:not(.mobile-menu) {
    display: none !important;
  }
}

/* ================ Mobile Breakpoint (max-width: 767px) ================ */
@media (max-width: 767px) {
  /* Container adjustments */
  .container,
  .wrapper,
  .main,
  .content,
  .section,
  main,
  .header .container,
  header .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-inline: 16px !important;
    margin-inline: auto !important;
  }

  /* Typography scaling */
  .hero-title {
    font-size: 1.75rem;
    line-height: 1.2;
  }

  .hero-sub {
    font-size: 1rem;
    line-height: 1.5;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  h3 {
    font-size: 1.25rem;
  }

  /* Hero section */
  .hero {
    padding: 2rem 0;
  }

  /* Two column layouts become single column */
  .two-col {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Tool interface */
  .tool-interface {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Tools grid */
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Features grid */
  .features-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Benefits grid */
  .benefits-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Tips grid */
  .tips-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Security features */
  .security-features,
  .limitations {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  /* Cards */
  .card {
    padding: 1.25rem;
  }

  /* Tool cards */
  .tool-card {
    padding: 1.5rem;
  }

  /* Buttons */
  .btn,
  .btn-secondary {
    width: 100%;
    max-width: 100%;
    padding: 14px 20px;
    font-size: 1rem;
  }

  .btn.large {
    padding: 16px 24px;
    font-size: 1.1rem;
  }

  /* Action buttons */
  .action-buttons {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .action-buttons .btn {
    width: 100%;
  }

  /* Success buttons */
  .success-buttons {
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
  }

  .success-buttons .btn {
    width: 100%;
  }

  /* Support actions */
  .support-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
  }

  .support-actions .btn {
    width: 100%;
  }

  /* Navigation */
  .mobile-menu-toggle {
    display: block !important;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  .nav:not(.mobile-menu) {
    display: none !important;
  }

  .mobile-menu {
    padding: 1rem;
  }

  .mobile-menu .nav-link {
    width: 100%;
    padding: 14px 16px;
    min-height: 44px;
  }

  /* Hide usage counter on mobile */
  .usage-counter {
    display: none !important;
  }

  /* Header */
  .header-in {
    gap: 1rem;
  }

  /* Footer */
  .footer-in {
    flex-direction: column;
    text-align: center;
    gap: 2rem;
  }

  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: 1rem;
  }

  /* Registration form */
  .registration-form {
    padding: 1.5rem;
    margin: 0 1rem;
  }

  /* Form groups */
  .form-group {
    margin-bottom: 1rem;
  }

  /* Contact form */
  .contact-form {
    gap: 1rem;
  }

  .contact-info {
    gap: 1rem;
  }

  /* Privacy and terms sections */
  .privacy-sections,
  .terms-sections {
    gap: 1rem;
  }

  .privacy-item,
  .terms-item {
    padding: 1rem;
  }

  /* FAQ */
  .faq {
    gap: 1rem;
  }

  .faq-item {
    padding: 1rem;
  }

  /* Tools row */
  .tools-row {
    justify-content: center;
    gap: 0.5rem;
  }

  .pill {
    padding: 10px 16px;
    font-size: 0.9rem;
    min-height: 44px;
  }

  /* Page content */
  .page-content {
    padding: 1rem 0;
  }

  /* Ad disclaimer */
  .ad-disclaimer {
    padding: 1rem;
    font-size: 0.85rem;
  }

  /* Upload area */
  .upload-area-large {
    padding: 2rem 1rem;
  }

  /* File items */
  .file-item {
    padding: 12px;
    flex-wrap: wrap;
  }

  /* Conversion options */
  .conversion-options {
    padding: 1.25rem;
  }

  .options-grid {
    gap: 0.75rem;
  }

  .option {
    padding: 12px;
    min-height: 44px;
  }

  /* Tables */
  table {
    font-size: 0.9rem;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ================ Small Mobile Breakpoint (max-width: 480px) ================ */
@media (max-width: 480px) {
  .container {
    padding-inline: 12px !important;
  }

  .hero-title {
    font-size: 1.5rem;
  }

  .hero-sub {
    font-size: 0.9rem;
  }

  .card {
    padding: 1rem;
  }

  .tool-card {
    padding: 1.25rem;
  }

  .btn {
    padding: 12px 16px;
    font-size: 0.95rem;
  }

  .hero {
    padding: 1.5rem 0;
  }

  .tools-title {
    font-size: 1.75rem;
  }

  .registration-form {
    padding: 1.25rem;
  }

  .registration-form h2 {
    font-size: 1.5rem;
  }
}

/* ================ Landscape Mobile Optimization ================ */
@media (max-height: 500px) and (orientation: landscape) {
  .hero {
    padding: 1rem 0;
  }

  .hero-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
  }

  .hero-sub {
    font-size: 0.9rem;
    margin-bottom: 1rem;
  }

  .card {
    padding: 1rem;
  }

  .mobile-menu {
    max-height: 80vh;
    overflow-y: auto;
  }
}

/* ================ Prevent Horizontal Scroll ================ */
@media (max-width: 1200px) {
  html,
  body {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  #app,
  #root,
  #page,
  #wrapper,
  #content,
  #main,
  .site,
  .layout,
  .page,
  .page-content {
    min-width: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  img,
  video,
  iframe,
  canvas,
  svg {
    max-width: 100% !important;
    height: auto !important;
  }
}

/* ================ Improved Touch Targets ================ */
@media (hover: none) and (pointer: coarse) {
  /* Increase spacing for touch devices */
  .nav-link {
    padding: 14px 16px;
  }

  .tool-card {
    margin-bottom: 12px;
  }

  /* Larger tap targets for icons */
  .tool-ic {
    width: 64px;
    height: 64px;
    font-size: 28px;
  }

  /* Better spacing for form elements */
  .form-group {
    margin-bottom: 1.25rem;
  }

  /* Larger checkboxes and radio buttons */
  input[type="checkbox"],
  input[type="radio"] {
    min-width: 20px;
    min-height: 20px;
    margin: 4px;
  }
}

/* ================ Accessibility: Focus States ================ */
@media (max-width: 767px) {
  *:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
  }

  button:focus,
  a:focus,
  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
  }
}

/* ================ Print Styles ================ */
@media print {
  .header,
  .footer,
  .mobile-menu-toggle,
  .mobile-menu,
  .usage-counter,
  .cta-btn,
  .ad-disclaimer,
  [class*="ad-"],
  .adsbygoogle {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
  }

  .container {
    max-width: 100%;
    padding: 0;
  }
}
