/* ===================================
   COMPREHENSIVE MOBILE RESPONSIVE DESIGN
   For Thai Engineering Website
   =================================== */

/* ===== TOUCH-FRIENDLY TARGETS ===== */
/* Ensure all interactive elements are at least 44x44px */
button, a, input[type="submit"], .btn {
  min-height: 44px;
  min-width: 44px;
}

/* ===== BASE RESPONSIVE IMPROVEMENTS ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  overflow-x: hidden;
  background: var(--bg, #edf2f4);
}

/* ===== HEADER RESPONSIVE ===== */
@media (max-width: 900px) {
  .header-bar {
    gap: 0.5rem;
    flex-wrap: wrap;
  }

  .nav {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 10px);
    width: auto;
    background: white;
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
  }

  .nav.active,
  .nav.is-open {
    display: flex;
  }

  .nav a {
    padding: 0.75rem 1rem;
    min-height: 44px;
    display: flex;
    align-items: center;
    width: 100%;
  }

  .nav-toggle {
    display: flex;
  }
}

/* ===== CALL BUTTON OPTIMIZATION ===== */
@media (max-width: 600px) {
  .call-btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
}

/* ===== SLIDER/CAROUSEL RESPONSIVE ===== */
@media (max-width: 900px) {
  .product-showcase {
    flex-direction: column-reverse;
    padding: 1.5rem 1rem;
    gap: 2rem;
    text-align: center;
  }

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

  .image-content {
    width: 100%;
  }

  .image-content img {
    width: 100%;
    height: auto;
    max-width: 100%;
    margin-right: 0;
  }

  .nav-arrow {
    padding: 10px 15px;
    font-size: 1.2rem;
    min-height: 44px;
    min-width: 44px;
  }
}

@media (max-width: 600px) {
  .main-display {
    padding: 1.5rem 0;
  }

  .title {
    font-size: 1.3rem;
  }

  .description {
    font-size: 0.85rem;
  }
}

/* ===== CARDS GRID RESPONSIVE ===== */
@media (max-width: 900px) {
  .card {
    width: calc(50% - 10px);
    height: 90px;
    margin-bottom: 15px;
  }
}

@media (max-width: 600px) {
  .card {
    width: 100%;
    height: 80px;
    margin-bottom: 10px;
  }

  .number {
    font-size: 22px;
  }

  .text {
    font-size: 13px;
  }
}

/* ===== ABOUT SECTION RESPONSIVE ===== */
@media (max-width: 900px) {
  .about-section {
    padding: 40px 20px;
  }

  .content-container {
    flex-direction: column;
    gap: 2rem;
  }

  .image-wrapper,
  .text-content {
    width: 100%;
  }

  .image-frame {
    display: none;
  }

  .main-image {
    width: 100%;
  }

  .text-content p {
    margin-left: 0;
    text-align: left;
  }

  .action-row {
    flex-direction: column;
    gap: 15px;
  }

  .contact-btn {
    width: 100%;
    padding: 12px 24px;
  }

  .rating {
    justify-content: center;
  }
}

/* ===== FORM FIELDS RESPONSIVE ===== */
@media (max-width: 900px) {
  .row {
    flex-direction: column;
    gap: 0;
  }

  .input-group {
    width: 100%;
    margin-bottom: 15px;
  }

  input, textarea {
    padding: 12px 15px;
    font-size: 16px;
    min-height: 44px;
  }

  label {
    font-size: 0.95rem;
    margin-bottom: 6px;
  }
}

@media (max-width: 600px) {
  .submit-btn {
    width: 100%;
    padding: 12px 20px;
    min-height: 44px;
  }

  .contact-card {
    padding: 20px;
  }

  .contact-card h2 {
    font-size: 1.5rem;
    margin-bottom: 20px;
  }
}

/* ===== CONTACT FORM RESPONSIVE ===== */
@media (max-width: 900px) {
  .container.contact-wrapper {
    flex-direction: column;
    gap: 2rem;
    padding: 0 20px;
  }

  .contact-card,
  .map-section {
    width: 100%;
    max-width: 100%;
  }

  .map-container {
    height: 350px;
  }

  .direction-btn {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 600px) {
  .map-container {
    height: 300px;
  }

  .direction-btn {
    padding: 12px 15px;
    font-size: 1rem;
  }
}

/* ===== FOOTER RESPONSIVE ===== */
@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footer-info,
  .footer-nav,
  .footer-follow {
    text-align: center;
  }

  .footer-follow .socials {
    justify-content: center;
  }
}

@media (max-width: 600px) {
  .footer-grid {
    gap: 1.5rem;
  }

  .footer-follow .socials {
    gap: 0.5rem;
  }

  .social {
    width: 40px;
    height: 40px;
    min-height: 44px;
    min-width: 44px;
  }
}

/* ===== VIDEO GALLERY RESPONSIVE ===== */
@media (max-width: 1200px) {
  .large-grid {
    grid-template-columns: 1fr !important;
  }

  .small-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 900px) {
  .large-grid,
  .small-grid {
    grid-template-columns: 1fr !important;
  }

  .video-frame {
    padding-bottom: 56.25%;
  }

  .video-info {
    padding: 15px;
  }
}

/* ===== TEXT RESPONSIVENESS ===== */
@media (max-width: 900px) {
  .section-title,
  .section-heading {
    font-size: clamp(1.5rem, 4vw, 2.2rem);
  }

  .contact-hero h1 {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }
}

/* ===== CONTAINER RESPONSIVE ===== */
@media (max-width: 900px) {
  .container {
    width: 90%;
    padding: 0 15px;
  }
}

@media (max-width: 600px) {
  .container {
    width: 95%;
    padding: 0 10px;
  }
}

/* ===== EXTRA SMALL DEVICES (< 380px) ===== */
@media (max-width: 380px) {
  html {
    font-size: 14px;
  }

  .header-bar {
    padding: 0.5rem 0;
  }

  .nav-toggle {
    min-width: 40px;
    min-height: 40px;
  }

  .card {
    width: calc(50% - 7px);
    height: 70px;
  }

  .contact-card {
    padding: 15px;
    border-radius: 15px;
  }

  .contact-card h2 {
    font-size: 1.3rem;
  }

  .submit-btn {
    padding: 10px 15px;
    font-size: 0.9rem;
  }

  input, textarea {
    font-size: 16px;
    padding: 10px 12px;
  }

  button {
    font-size: 0.85rem;
    padding: 8px 12px;
  }

  .title {
    font-size: 1.1rem;
  }

  .description {
    font-size: 0.75rem;
  }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (max-height: 600px) and (orientation: landscape) {
  .main-display {
    padding: 2rem 0;
  }

  .product-showcase {
    padding: 1rem;
    gap: 1rem;
  }

  .contact-hero {
    padding: 2rem 0;
  }
}

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

@media (prefers-color-scheme: dark) {
  body {
    background: #1a1a1a;
    color: #f0f0f0;
  }
}
