/* ==================== RESPONSIVE DESIGN ==================== */

/* Large Desktop (1400px and up) */
@media screen and (min-width: 1400px) {
  :root {
    --container-width: 1320px;
  }
}

/* Desktop (992px to 1199px) */
@media screen and (max-width: 1199px) {
  :root {
    --container-width: 960px;
  }
}

/* Tablet (768px to 991px) */
@media screen and (max-width: 991px) {
  :root {
    --container-width: 720px;
    --header-height: 70px;
  }
}

/* Mobile (576px to 767px) */
@media screen and (max-width: 767px) {
  :root {
    --container-width: 540px;
    --header-height: 65px;
  }
}

/* Small Mobile (up to 575px) */
@media screen and (max-width: 575px) {
  .container {
    padding: 0 var(--spacing-md);
  }
}

/* ==================== COMPONENT RESPONSIVE STYLES ==================== */

/* Typography */
@media screen and (max-width: 768px) {
  h1 { font-size: var(--font-size-4xl); }
  h2 { font-size: var(--font-size-3xl); }
  h3 { font-size: var(--font-size-2xl); }
  h4 { font-size: var(--font-size-xl); }
  h5 { font-size: var(--font-size-lg); }
}

/* Buttons */
@media screen and (max-width: 576px) {
  .btn {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-size-sm);
  }

  .btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: var(--font-size-base);
  }
}

/* Grid Layouts */
@media screen and (max-width: 992px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media screen and (max-width: 576px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Spacing Utilities */
@media screen and (max-width: 768px) {
  .section {
    padding: var(--spacing-3xl) 0;
  }

  .section__header {
    margin-bottom: var(--spacing-2xl);
  }
}

/* Modal */
@media screen and (max-width: 576px) {
  .modal {
    padding: var(--spacing-md);
  }

  .modal__content {
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
  }
}

/* Forms */
@media screen and (max-width: 576px) {
  .form__input,
  .form__textarea {
    padding: 0.75rem 1rem;
    font-size: var(--font-size-sm);
  }
}

/* Cards */
@media screen and (max-width: 768px) {
  .card {
    padding: var(--spacing-lg);
  }
}

/* Hide/Show Elements */
@media screen and (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
}

@media screen and (min-width: 769px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Flex Direction */
@media screen and (max-width: 768px) {
  .flex-column-mobile {
    flex-direction: column;
  }
}

/* Text Alignment */
@media screen and (max-width: 768px) {
  .text-center-mobile {
    text-align: center;
  }
}

/* Full Width on Mobile */
@media screen and (max-width: 576px) {
  .full-width-mobile {
    width: 100%;
  }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
  /* Larger touch targets */
  .btn,
  .nav__link,
  a {
    min-height: 44px;
    min-width: 44px;
  }

  /* Remove hover effects on touch devices */
  .hover-lift:hover,
  .hover-scale:hover,
  .hover-glow:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Print Styles */
@media print {
  .header,
  .nav,
  .footer,
  .modal,
  .toast-container,
  .cart-sidebar,
  .btn,
  button {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .section {
    page-break-inside: avoid;
  }
}

/* High Resolution Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Optimizations for retina displays */
  img {
    image-rendering: -webkit-optimize-contrast;
  }
}

/* Landscape Orientation */
@media screen and (max-width: 768px) and (orientation: landscape) {
  .hero {
    min-height: auto;
    padding: var(--spacing-3xl) 0;
  }

  .modal__content {
    max-height: 85vh;
  }
}

/* Small Desktop Adjustments */
@media screen and (max-width: 1024px) {
  .hero__stats {
    gap: var(--spacing-md);
  }

  .services__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Tablet Portrait */
@media screen and (max-width: 768px) {
  .hero__container {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero__buttons {
    justify-content: center;
  }

  .services__grid {
    grid-template-columns: 1fr;
  }

  .contact__container {
    grid-template-columns: 1fr;
  }
}

/* Mobile Specific */
@media screen and (max-width: 576px) {
  /* Sticky Header Adjustment */
  .header {
    padding: 0 var(--spacing-md);
  }

  /* Hero Section */
  .hero__greeting {
    font-size: var(--font-size-lg);
  }

  .hero__name {
    font-size: var(--font-size-4xl);
  }

  .hero__description {
    font-size: var(--font-size-base);
  }

  .hero__stats {
    grid-template-columns: 1fr;
  }

  /* Service Cards */
  .service-card {
    padding: var(--spacing-lg);
  }

  .service-card__icon {
    width: 60px;
    height: 60px;
    font-size: var(--font-size-2xl);
  }

  /* Footer */
  .footer__container {
    gap: var(--spacing-xl);
  }

  /* Products */
  .filter__controls {
    overflow-x: auto;
    justify-content: flex-start;
  }
}

/* Very Small Screens */
@media screen and (max-width: 360px) {
  :root {
    --font-size-base: 0.875rem;
  }

  .container {
    padding: 0 var(--spacing-sm);
  }
}

/* Accessibility - High Contrast Mode */
@media (prefers-contrast: high) {
  .btn-primary {
    border: 2px solid white;
  }

  .card {
    border-width: 2px;
  }
}

/* Dark Mode Adjustments for Mobile */
@media screen and (max-width: 768px) {
  body.dark-theme .modal__content {
    background: var(--color-surface);
  }
}
