:root {
  --primary-color: #0e273c;
  --accent-color: #33b2d7;
  --bg-light: #f5f8fa;
  --text-color: #333;
  --white: #fff;
  --gray-light: #f8f9fa;
  --sidebar-bg: #f8f9fa;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: 'Montserrat', sans-serif;
  background: var(--white);
  color: var(--text-color);
  line-height: 1.6;
  height: auto;
  width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.lang-th {
  font-family: 'Noto Serif Thai', serif;
}

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Hero Header - Enhanced Responsiveness */
.hero-header {
  width: 100%;
  background-color: #e2ecef;
  padding: clamp(15px, 4vw, 20px) clamp(8px, 2vw, 10px);
  margin-bottom: 0px;
  text-align: center;
  color: #164f72;
  min-height: clamp(120px, 20vh, 150px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.hero-title {
  font-size: clamp(1.2rem, 4vw, 2rem);
  font-weight: bold;
  margin-bottom: clamp(8px, 2vw, 10px);
  margin-top: clamp(8px, 2vw, 10px);
  line-height: 1.2;
  text-align: center;
}

.hero-subtitle {
  font-size: clamp(1rem, 3vw, 1.2rem);
  opacity: 0.8;
  margin-bottom: clamp(15px, 3vw, 20px);
  text-align: center;
}

.hero-badges {
  display: flex;
  justify-content: center;
  gap: clamp(10px, 3vw, 20px);
  flex-wrap: wrap;
  margin-top: clamp(15px, 3vw, 20px);
}

.badge {
  background: rgba(51, 178, 215, 0.1);
  color: var(--primary-color);
  padding: clamp(6px, 1.5vw, 8px) clamp(12px, 3vw, 16px);
  border-radius: 20px;
  font-size: clamp(12px, 2.5vw, 14px);
  font-weight: 500;
  border: 1px solid rgba(51, 178, 215, 0.3);
  white-space: nowrap;
}

/* Main Content - Desktop-first with mobile optimization */
.main-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: clamp(20px, 5vw, 40px) clamp(10px, 3vw, 20px);
  display: grid;
  grid-template-columns: 2fr 2fr;
  gap: clamp(30px, 8vw, 60px);
  align-items: stretch;
}

/* FIXED Product Images Section - No gaps or backgrounds */
.product-images {
  position: sticky;
  top: 120px;
}

.main-image-container {
  position: relative;
  border: 1px solid #e0e0e0;
  border-radius: 0px;
  aspect-ratio: 1;
  display: block;
  overflow: hidden;
  background: transparent;
}

.main-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.3s ease;
}

.image-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  width: clamp(30px, 8vw, 40px);
  height: clamp(30px, 8vw, 40px);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 4vw, 18px);
  color: var(--text-color);
  transition: all 0.3s ease;
  border-radius: 50%;
}

.image-nav:hover {
  background: var(--accent-color);
  color: white;
}

.image-nav.prev { left: clamp(5px, 2vw, 10px); }
.image-nav.next { right: clamp(5px, 2vw, 10px); }

.thumbnail-action-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 25px;
  margin-top: 50px;
  flex-wrap: wrap;
}

.thumbnail-grid {
  flex: 1 1 auto;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap !important; 
  gap: 20px;
  min-width: 250px;
  overflow-x: auto; 
  overflow-y: hidden;
  padding-bottom: 2px; 
  padding-top: 2px; 
  padding-left: 2px; 
}

.thumbnail {
  width: 80px !important; 
  height: 80px !important;
  min-width: 80px !important; 
  flex-shrink: 0 !important; 
  aspect-ratio: 1;
  background: transparent;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.3s ease;
  display: block;
  border-radius: 0px;
  overflow: hidden;
  transform: scale(1);
}

.thumbnail:hover,
.thumbnail.active {
  border-color: var(--accent-color);
  transform: scale(1.00);
  box-shadow: 0 2px 8px rgba(51, 178, 215, 0.3);
}

.thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Product Info Section - Desktop design with enhanced spacing */
.product-info {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.product-info h1 {
  font-size: clamp(1.4rem, 5vw, 2.5rem);
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: clamp(6px, 1.5vw, 8px);
  line-height: 1.2;
}

.product-subtitle {
  font-size: clamp(1rem, 3vw, 1.3rem);
  color: var(--accent-color);
  margin-bottom: clamp(12px, 3vw, 15px);
  font-weight: 500;
  line-height: 1.3;
}

.product-description {
  font-size: clamp(0.95rem, 2.5vw, 1.1rem);
  line-height: clamp(1.6, 0.2vw + 1.5, 2);
  margin-bottom: clamp(12px, 3vw, 15px);
  color: var(--text-color);
  max-width: 800px;
  text-align: justify;
}

.features-section {
  margin: clamp(8px, 2vw, 10px) 0 clamp(25px, 5vw, 30px) 0;
}

.features-title {
  font-size: clamp(1.2rem, 3.5vw, 1.5rem);
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: clamp(12px, 3vw, 15px);
}

.feature-list {
  list-style: none;
  margin-bottom: 0;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: clamp(10px, 3vw, 15px);
  margin-bottom: clamp(10px, 2.5vw, 12px);
  padding: clamp(10px, 2.5vw, 12px);
  background: var(--gray-light);
  transition: all 0.3s ease;
  font-size: clamp(0.9rem, 2.2vw, 1rem);
  border-radius: 6px;
}

.feature-list li span::before {
  content: '●';
  color: var(--accent-color);
  font-weight: 100;
  font-size: clamp(10px, 2.5vw, 12px);
  margin-right: clamp(8px, 2vw, 10px);
  margin-top: clamp(3px, 1vw, 5px);
}

.feature-list li:hover {
  background: rgba(51, 178, 215, 0.1);
  transform: translateX(5px);
}

/* Action Buttons - Desktop horizontal layout */
.action-filter-buttons {
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: auto;
  font-size: 12.5px;
  justify-content: space-between;
}

.btn-filter {
  flex: 1 1 30%;
  min-width: 150px;
  max-width: 33.33%;
  text-align: center;
  padding: 15px 20px;
  font-weight: 500;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  border-radius: 0px;
}

.btn-filter-primary {
  background: var(--accent-color);
  color: white;
}

.btn-filter-primary:hover {
  background: #2a9bc1;
  transform: translateY(-2px);
}

.btn-filter-secondary {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-filter-secondary:hover {
  background: var(--primary-color);
  color: white;
}

.btn-filter-tertiary {
  background: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.btn-filter-tertiary:hover {
  background: var(--primary-color);
  color: white;
}

/* Specifications Section - Enhanced */
.specs-section {
  grid-column: 1 / -1;
  margin-top: clamp(25px, 5vw, 30px);
  padding: clamp(25px, 6vw, 40px);
  background: var(--gray-light);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  width: 100%;
  overflow-x: auto;
}

.specs-header {
  text-align: center;
  margin-bottom: clamp(25px, 5vw, 30px);
}

.specs-header h2 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: clamp(8px, 2vw, 10px);
}

.specs-intro {
  max-width: 1400px;
  margin: clamp(15px, 4vw, 20px) auto clamp(30px, 6vw, 40px);
  padding: 0 clamp(15px, 4vw, 20px);
  font-size: clamp(0.9rem, 2.2vw, 1rem);
  color: var(--text-color);
  line-height: clamp(1.6, 0.2vw + 1.5, 1.8);
  text-align: justify;
}

.specs-intro strong {
  color: var(--accent-color);
  font-weight: 600;
}

/* Specifications Section - Desktop tabs layout */
.specs-tabs {
  display: flex;
  justify-content: flex-end;
  gap: 0;
  margin-bottom: 30px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  overflow: hidden;
}

.tab-btn {
  padding: 15px 30px;
  background: transparent;
  border: none;
  color: var(--text-color);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-right: 1px solid #ddd;
}

.tab-btn:last-child {
  border-right: none;
}

.tab-btn.active,
.tab-btn:hover {
  background: var(--accent-color);
  color: white;
}

.specs-content {
  display: none;
}

.specs-content.active {
  display: block;
}

.specs-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  margin-bottom: 30px;
  margin-top: 20px;
  table-layout: auto;
  border-radius: 6px;
  overflow: hidden;
}

.specs-table th {
  background: var(--primary-color);
  color: white;
  padding: 15px 12px;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.5px;
  white-space: nowrap;
  min-width: 80px;
}

.specs-table th:first-child {
  text-align: left;
  padding-left: 20px;
  min-width: 150px;
}

.specs-table td {
  padding: 15px 12px;
  text-align: center;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  min-width: 80px;
}

.specs-table td:first-child {
  background: var(--bg-light);
  font-weight: 600;
  text-align: left;
  padding-left: 20px;
  color: var(--primary-color);
  white-space: normal;
  min-width: 150px;
}

.specs-table tr:last-child td {
  border-bottom: none;
}

.specs-table tr:nth-child(even) td:not(:first-child) {
  background: #fafbfc;
}

footer {
  background: var(--primary-color);
  color: white;
  text-align: center;
  padding: clamp(30px, 6vw, 40px) clamp(15px, 4vw, 20px);
  font-weight: 500;
  margin-top: auto;
  font-size: clamp(0.9rem, 2.2vw, 1rem);
}

/* Language toggle styles */
.lang-btn {
  padding: clamp(4px, 1vw, 5px) clamp(8px, 2vw, 10px);
  margin: 0 clamp(1px, 0.5vw, 2px);
  background: transparent;
  border: 1px solid var(--accent-color);
  color: var(--accent-color);
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: clamp(11px, 2.5vw, 14px);
  border-radius: 4px;
}

.lang-btn.active,
.lang-btn:hover {
  background: var(--accent-color);
  color: white;
}

/* Hide non-active language content */
.lang-en, .lang-th {
  display: block;
}

body.thai-active .lang-en {
  display: none;
}

body.thai-active .lang-th {
  display: block;
}

body:not(.thai-active) .lang-th {
  display: none;
}

body:not(.thai-active) .lang-en {
  display: block;
}

/* Animation */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes ripple {
  to {
    transform: scale(2);
    opacity: 0;
  }
}

/* Mobile-First Responsive Design */
@media (max-width: 1024px) {
  .main-content {
    grid-template-columns: 1fr;
  }

  .product-images {
    position: static;
  }

  .product-info {
    padding-left: 0;
  }
}

@media (max-width: 768px) {
  .hero-badges {
    flex-direction: column;
    align-items: center;
    gap: clamp(8px, 2vw, 10px);
  }

  .thumbnail-action-row {
    flex-direction: column;
    align-items: stretch;
  }

  .thumbnail-grid {
    width: 100% !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    order: 2;
    margin-top: clamp(15px, 3vw, 20px);
    gap: 8px;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    padding-bottom: 5px;
  }

  .thumbnail-grid > * {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    background: transparent !important;
  }

  .action-filter-buttons {
    order: 1;
    flex-direction: row;
    gap: 8px;
    justify-content: space-between;
  }

  .btn-filter {
    flex: 1;
    box-sizing: border-box;
    padding: 16px 12px;
    font-size: 13px;
    display: flex;
    min-width: auto;
    max-width: none;
  }

  .specs-tabs {
    flex-direction: column;
    border-radius: 6px;
  }

  .tab-btn {
    border-right: none;
    border-bottom: 1px solid #ddd;
    padding: 12px 25px;
    font-size: 13px;
  }

  .tab-btn:last-child {
    border-bottom: none;
  }

  .specs-table {
    font-size: 12px;
    overflow-x: auto;
    display: block;
    border-radius: 6px;
  }

  .specs-table thead,
  .specs-table tbody,
  .specs-table tr {
    display: table;
    width: 100%;
  }

  .specs-table th,
  .specs-table td {
    padding: 10px 8px;
    font-size: 12px;
    min-width: 60px;
  }

  .specs-table th:first-child,
  .specs-table td:first-child {
    min-width: 120px;
    padding-left: 15px;
  }
}

@media (max-width: 480px) {
  .thumbnail-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .btn-filter {
    padding: 12px 8px;
    font-size: 11px;
  }

  .tab-btn {
    padding: 10px 12px;
    font-size: 11px;
  }

  .specs-table th,
  .specs-table td {
    padding: 8px 6px;
    font-size: 11px;
    min-width: 50px;
  }

  .specs-table th:first-child,
  .specs-table td:first-child {
    min-width: 100px;
    padding-left: 12px;
  }
}

@media (max-width: 360px) {
  .main-content {
    padding: clamp(12px, 4vw, 15px) clamp(6px, 2vw, 8px);
  }

  .feature-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: clamp(5px, 1.5vw, 8px);
  }

  .thumbnail-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .btn-filter {
    padding: 10px 6px;
    font-size: 10px;
  }
}

/* Ultra-wide screens */
@media (min-width: 1600px) {
  .main-content {
    max-width: 1600px;
    padding: 50px 30px;
  }

  .hero-header {
    height: 180px;
  }
}

/* Very small screens (smartwatches, etc.) */
@media (max-width: 280px) {
  .main-content {
    padding: 10px 5px;
  }

  .hero-header {
    padding: 10px 5px;
    min-height: 100px;
  }

  .thumbnail-grid {
    grid-template-columns: 1fr 1fr;
  }

  .action-filter-buttons {
    gap: 5px;
    flex-direction: column;
  }

  .btn-filter {
    font-size: 8px;
    padding: 8px 10px;
  }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .main-image,
  .thumbnail img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn-filter {
    min-height: 48px;
  }

  .tab-btn {
    min-height: 48px;
  }

  .lang-btn {
    min-height: 36px;
    min-width: 36px;
  }

  .image-nav {
    width: clamp(40px, 12vw, 50px);
    height: clamp(40px, 12vw, 50px);
  }
}

/* Print styles */
@media print {
  .image-nav,
  .action-filter-buttons,
  .specs-tabs {
    display: none;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .specs-table {
    page-break-inside: avoid;
  }
}