/**
 * Responsive Styles for Printing Indonesia Theme
 * Mobile-first approach with enhanced dark mode support
 */

/* ==========================================================================
   Base Responsive
   ========================================================================== */
@media (max-width: 767px) {
  :root {
    --space-4: 0.75rem;
    --space-6: 1rem;
    --space-8: 1.5rem;
    --space-12: 2rem;
    --space-16: 2.5rem;
    --space-20: 3rem;
    --space-24: 4rem;
  }

  .container {
    padding: 0 var(--space-4);
  }
}

/* ==========================================================================
   Mobile (0px - 767px)
   ========================================================================== */
@media (max-width: 767px) {
  /* Typography */
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  h3 { font-size: var(--text-xl); }
  h4 { font-size: var(--text-lg); }
  
  .section-title { font-size: var(--text-2xl); }
  .hero-title { font-size: var(--text-3xl); }

  /* Header */
  .header-container {
    padding: var(--space-3) 0;
  }

  .site-logo img {
    height: 32px;
  }

  /* Hero Section */
  .hero-content {
    padding: var(--space-16) 0;
  }

  .hero-services {
    gap: var(--space-3);
  }

  .service-link {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn-hero-primary,
  .btn-hero-secondary {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  /* Sections */
  .features-section,
  .services-section,
  .gallery-section,
  .products-section,
  .blog-section,
  .cta-section {
    padding: var(--space-12) 0;
  }

  .section-header {
    margin-bottom: var(--space-8);
  }

  /* Features Grid */
  .features-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .feature-card {
    padding: var(--space-6);
  }

  /* Services Grid */
  .services-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .service-card {
    padding: var(--space-6);
  }

  /* Products Grid */
  .products-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .products-grid-mini {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .product-card {
    margin-bottom: var(--space-4);
  }

  .product-actions {
    flex-direction: column;
  }

  /* Gallery Grid */
  .gallery-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .gallery-grid-masonry {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  /* Blog Grid */
  .blog-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .blog-card {
    margin-bottom: var(--space-4);
  }

  /* CTA Section */
  .cta-title {
    font-size: var(--text-2xl);
  }

  .cta-description {
    font-size: var(--text-lg);
  }

  .cta-actions {
    flex-direction: column;
    align-items: center;
  }

  .btn-cta-whatsapp,
  .btn-cta-secondary,
  .btn-cta-outline {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .cta-features {
    flex-direction: column;
    align-items: center;
    gap: var(--space-4);
  }

  /* Single Product */
  .single-product {
    padding: var(--space-8) 0;
  }

  .product-main {
    gap: var(--space-6);
  }

  .product-gallery {
    position: static;
  }

  .product-gallery-thumbnails {
    grid-template-columns: repeat(3, 1fr);
  }

  .thumbnail-item img {
    height: 60px;
  }

  .product-title {
    font-size: var(--text-2xl);
  }

  .product-price {
    font-size: var(--text-2xl);
  }

  .specs-grid {
    grid-template-columns: 1fr;
  }

  .spec-row {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }

  .tabs-nav {
    flex-direction: column;
  }

  .tab-button {
    border-bottom: 1px solid var(--color-border);
    border-right: none;
  }

  .tab-button.active {
    border-bottom-color: var(--color-primary);
    border-right: none;
  }

  /* Modal */
  .modal-container {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }

  .modal-content {
    grid-template-columns: 1fr;
  }

  .gallery-info-sidebar {
    max-height: 40vh;
    overflow-y: auto;
  }

  .nav-arrow {
    width: 40px;
    height: 40px;
    padding: var(--space-3);
  }

  .nav-prev {
    left: var(--space-3);
  }

  .nav-next {
    right: var(--space-3);
  }

  /* Footer */
  .footer-main {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    padding: var(--space-8) 0;
  }

  .footer-links {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--space-4);
  }

  .footer-social {
    justify-content: center;
  }

  /* Search Overlay */
  .search-container {
    width: 95%;
    padding: var(--space-6);
  }

  .search-form {
    flex-direction: column;
    gap: var(--space-3);
  }

  /* Floating Elements */
  .floating-whatsapp {
    bottom: var(--space-4);
    right: var(--space-4);
  }

  .floating-button {
    width: 50px;
    height: 50px;
  }

  .back-to-top {
    bottom: var(--space-4);
    right: var(--space-4);
    width: 44px;
    height: 44px;
  }
}

/* ==========================================================================
   Tablet (768px - 1023px)
   ========================================================================== */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Typography */
  h1 { font-size: var(--text-3xl); }
  h2 { font-size: var(--text-2xl); }
  
  .section-title { font-size: var(--text-3xl); }
  .hero-title { font-size: var(--text-4xl); }

  /* Header */
  .header-container {
    padding: var(--space-3) 0;
  }

  /* Hero Section */
  .hero-content {
    padding: var(--space-16) 0;
  }

  /* Sections */
  .features-section,
  .services-section,
  .gallery-section,
  .products-section,
  .blog-section,
  .cta-section {
    padding: var(--space-16) 0;
  }

  /* Grid Layouts */
  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Single Product */
  .product-main {
    gap: var(--space-8);
  }

  .product-gallery-thumbnails {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Footer */
  .footer-links {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Modal */
  .modal-container {
    width: 90%;
  }

  .modal-content {
    grid-template-columns: 1fr 250px;
  }
}

/* ==========================================================================
   Desktop (1024px - 1199px)
   ========================================================================== */
@media (min-width: 1024px) and (max-width: 1199px) {
  .container {
    max-width: 1000px;
  }

  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ==========================================================================
   Large Desktop (1200px and up)
   ========================================================================== */
@media (min-width: 1200px) {
  .container {
    max-width: 1200px;
  }

  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ==========================================================================
   Dark Mode Enhancements for Mobile
   ========================================================================== */
@media (max-width: 767px) {
  [data-theme="dark"] {
    /* Enhanced contrast for mobile dark mode */
    --color-text: var(--color-gray-100);
    --color-text-light: var(--color-gray-300);
    --color-background: var(--color-gray-900);
    --color-surface: var(--color-gray-800);
    --color-border: var(--color-gray-700);
  }

  [data-theme="dark"] .mobile-menu-panel {
    background: var(--color-gray-900);
    border-left-color: var(--color-gray-700);
  }

  [data-theme="dark"] .mobile-menu-header {
    background: var(--color-gray-800);
    border-bottom-color: var(--color-gray-700);
  }

  [data-theme="dark"] .mobile-service-item {
    background: var(--color-gray-800);
    border-color: var(--color-gray-700);
  }

  [data-theme="dark"] .mobile-service-item:hover {
    border-color: var(--color-primary);
  }
}

/* ==========================================================================
   Touch Device Optimizations
   ========================================================================== */
@media (hover: none) and (pointer: coarse) {
  /* Increase tap targets for touch devices */
  .search-toggle,
  .ecommerce-toggle-btn,
  .dark-mode-toggle,
  .mobile-menu-close,
  .modal-close,
  .nav-arrow,
  .thumb-nav {
    min-width: 44px;
    min-height: 44px;
  }

  .menu-item a,
  .filter-tab,
  .category-tab,
  .view-btn,
  .service-link,
  .tag,
  .share-button {
    min-height: 44px;
    display: flex;
    align-items: center;
  }

  .btn-hero-primary,
  .btn-hero-secondary,
  .btn-cta-whatsapp,
  .btn-cta-secondary,
  .btn-cta-outline,
  .btn-view-all,
  .btn-load-more,
  .form-submit {
    min-height: 50px;
  }

  /* Remove hover effects for touch devices */
  .feature-card:hover,
  .service-card:hover,
  .product-card:hover,
  .gallery-item:hover,
  .blog-card:hover {
    transform: none;
  }

  /* Show focus states for better accessibility */
  button:focus,
  a:focus,
  input:focus,
  select:focus,
  textarea:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
  }
}

/* ==========================================================================
   High DPI/Retina Displays
   ========================================================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .hero-section {
    background-image: url('assets/images/backgrounds/hero-bg@2x.gif');
  }

  .feature-icon img,
  .service-icon img,
  .tab-icon img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {
  .site-header,
  .mobile-menu-enhanced,
  .floating-whatsapp,
  .back-to-top,
  .cta-section,
  .site-footer {
    display: none !important;
  }

  .site-content {
    margin: 0 !important;
    padding: 0 !important;
  }

  .container {
    max-width: none !important;
    padding: 0 !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.4;
    color: #000 !important;
    background: #fff !important;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #000 !important;
    page-break-after: avoid;
  }

  a {
    color: #000 !important;
    text-decoration: underline !important;
  }

  img {
    max-width: 100% !important;
    height: auto !important;
  }

  .product-gallery,
  .product-info {
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   Reduced Motion Preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero-section,
  .mobile-hero-slider {
    background-attachment: scroll !important;
  }

  .typed-cursor {
    animation: none !important;
    opacity: 1 !important;
  }

  .scroll-indicator {
    animation: none !important;
  }

  .floating-button {
    animation: none !important;
  }
}

/* ==========================================================================
   High Contrast Mode Support
   ========================================================================== */
@media (prefers-contrast: high) {
  :root {
    --color-primary: #000000;
    --color-primary-dark: #000000;
    --color-primary-light: #333333;
    --color-text: #000000;
    --color-text-light: #333333;
    --color-border: #000000;
  }

  [data-theme="dark"] {
    --color-primary: #ffffff;
    --color-primary-dark: #ffffff;
    --color-primary-light: #cccccc;
    --color-text: #ffffff;
    --color-text-light: #cccccc;
    --color-border: #ffffff;
  }

  .feature-card,
  .service-card,
  .product-card,
  .gallery-item,
  .blog-card {
    border-width: 2px;
  }

  .btn-hero-primary,
  .btn-hero-secondary,
  .btn-cta-whatsapp,
  .btn-cta-secondary,
  .btn-cta-outline {
    border-width: 2px;
  }
}