/* ServerConsultant Responsive Styles
   All media queries in one central location
   ========================================= */

/* Mobile First Approach - Base styles are for mobile */

/* Very Small Devices (320px minimum)
   ----------------------------------------- */
@media (min-width: 320px) {
  /* Ensure minimum readable font sizes */
  html {
    font-size: 14px; /* Slightly smaller base for very narrow screens */
  }
  
  /* Container minimum padding */
  .sc-container {
    padding-left: var(--sc-space-3);
    padding-right: var(--sc-space-3);
  }
}

/* Small Devices (480px and up)
   ----------------------------------------- */
@media (min-width: 480px) {
  /* Reset base font size */
  html {
    font-size: 16px;
  }
  
  /* Container adjustments */
  .sc-container {
    padding-left: var(--sc-space-8);
    padding-right: var(--sc-space-8);
  }

  /* Typography */
  h1 { font-size: var(--sc-text-6xl); }
  h2 { font-size: var(--sc-text-5xl); }
  h3 { font-size: var(--sc-text-4xl); }
  
  /* Grid system */
  .sc-grid--sm-1 { grid-template-columns: 1fr; }
  .sc-grid--sm-2 { grid-template-columns: repeat(2, 1fr); }
  .sc-grid--sm-3 { grid-template-columns: repeat(3, 1fr); }
  .sc-grid--sm-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Medium Devices (768px and up)
   ----------------------------------------- */
@media (min-width: 768px) {
  /* Container adjustments */
  .sc-container {
    padding-left: var(--sc-space-12);
    padding-right: var(--sc-space-12);
  }

  /* Grid system */
  .sc-grid--md-1 { grid-template-columns: 1fr; }
  .sc-grid--md-2 { grid-template-columns: repeat(2, 1fr); }
  .sc-grid--md-3 { grid-template-columns: repeat(3, 1fr); }
  .sc-grid--md-4 { grid-template-columns: repeat(4, 1fr); }
  
  /* Split layouts */
  .sc-split {
    grid-template-columns: 1fr 1fr;
  }
  
  /* Sidebar layouts */
  .sc-sidebar-layout {
    grid-template-columns: 300px 1fr;
  }
  
  /* Display utilities */
  .sc-u-md-hidden { display: none !important; }
  .sc-u-md-block { display: block !important; }
  .sc-u-md-inline-block { display: inline-block !important; }
  .sc-u-md-flex { display: flex !important; }
  .sc-u-md-grid { display: grid !important; }
}

/* Large Devices (1024px and up)
   ----------------------------------------- */
@media (min-width: 1024px) {
  /* Grid system */
  .sc-grid--lg-1 { grid-template-columns: 1fr; }
  .sc-grid--lg-2 { grid-template-columns: repeat(2, 1fr); }
  .sc-grid--lg-3 { grid-template-columns: repeat(3, 1fr); }
  .sc-grid--lg-4 { grid-template-columns: repeat(4, 1fr); }
  .sc-grid--lg-5 { grid-template-columns: repeat(5, 1fr); }
  .sc-grid--lg-6 { grid-template-columns: repeat(6, 1fr); }
  
  /* Display utilities */
  .sc-u-lg-hidden { display: none !important; }
  .sc-u-lg-block { display: block !important; }
  .sc-u-lg-inline-block { display: inline-block !important; }
  .sc-u-lg-flex { display: flex !important; }
  .sc-u-lg-grid { display: grid !important; }
}

/* Extra Large Devices (1280px and up)
   ----------------------------------------- */
@media (min-width: 1280px) {
  /* Container max widths */
  .sc-container {
    padding-left: var(--sc-space-16);
    padding-right: var(--sc-space-16);
  }
  
  /* Grid system */
  .sc-grid--xl-1 { grid-template-columns: 1fr; }
  .sc-grid--xl-2 { grid-template-columns: repeat(2, 1fr); }
  .sc-grid--xl-3 { grid-template-columns: repeat(3, 1fr); }
  .sc-grid--xl-4 { grid-template-columns: repeat(4, 1fr); }
  .sc-grid--xl-5 { grid-template-columns: repeat(5, 1fr); }
  .sc-grid--xl-6 { grid-template-columns: repeat(6, 1fr); }
}

/* Mobile and Tablet Only (max-width: 1023px)
   ----------------------------------------- */
@media (max-width: 1023px) {
  /* Navigation adjustments */
  .sc-nav--mobile {
    position: fixed;
    top: 0;
    left: -100%;
    width: 80%;
    height: 100vh;
    background-color: var(--sc-dark-blue);
    transition: left var(--sc-transition-base);
    z-index: var(--sc-z-fixed);
  }
  
  .sc-nav--mobile.is-open {
    left: 0;
  }
  
  /* Mobile menu overlay */
  .sc-nav-overlay {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: all var(--sc-transition-base);
    z-index: var(--sc-z-modal-backdrop);
  }
  
  .sc-nav-overlay.is-visible {
    opacity: 1;
    visibility: visible;
  }
}

/* Tablet Only (768px to 1023px)
   ----------------------------------------- */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Specific tablet adjustments */
  .sc-grid--tablet-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile Only (max-width: 767px)
   ----------------------------------------- */
@media (max-width: 767px) {
  /* Typography scale reduction */
  :root {
    --sc-text-4xl: 2rem;
    --sc-text-5xl: 2.5rem;
    --sc-text-6xl: 3rem;
  }
  
  /* Stack all grids on mobile */
  .sc-grid,
  .sc-split,
  .sc-sidebar-layout {
    grid-template-columns: 1fr !important;
  }
  
  /* Section spacing reduction */
  .sc-section {
    padding-top: var(--sc-space-12);
    padding-bottom: var(--sc-space-12);
  }
  
  /* Hero adjustments */
  .sc-hero {
    min-height: 80vh;
  }
  
  /* Card spacing */
  .sc-card {
    padding: var(--sc-space-4);
  }
  
  /* Button full width on mobile */
  .sc-btn {
    /* width: 100%; */
    justify-content: center;
  }
  
  /* Form elements */
  .sc-form-group {
    margin-bottom: var(--sc-space-4);
  }
  
  /* Hide desktop-only elements */
  .sc-u-desktop-only {
    display: none !important;
  }
}

/* Very Small Devices (max-width: 479px)
   ----------------------------------------- */
@media (max-width: 479px) {
  /* Container padding reduction */
  .sc-container {
    padding-left: var(--sc-space-4);
    padding-right: var(--sc-space-4);
  }
  
  /* Further typography reduction */
  :root {
    --sc-text-3xl: 1.5rem;
    --sc-text-4xl: 1.75rem;
    --sc-text-5xl: 2rem;
    --sc-text-6xl: 2.25rem;
  }
  
  /* Reduce section padding */
  .sc-section,
  .sc-content-section {
    padding-top: var(--sc-space-8);
    padding-bottom: var(--sc-space-8);
  }
  
  /* Stats grid single column */
  .sc-stats-grid {
    grid-template-columns: 1fr;
  }
  
  /* Smaller cards */
  .sc-card {
    padding: var(--sc-space-4);
  }
  
  /* CTA adjustments */
  .sc-cta {
    padding: var(--sc-space-8);
  }
  .sc-btn {
     width: 100%;
   
  }
}

/* Ultra Narrow Devices (max-width: 320px)
   ----------------------------------------- */
@media (max-width: 320px) {
  /* Minimum container padding */
  .sc-container {
    padding-left: var(--sc-space-3);
    padding-right: var(--sc-space-3);
  }
  
  /* Minimum typography sizes */
  :root {
    --sc-text-base: 0.875rem;
    --sc-text-lg: 1rem;
    --sc-text-xl: 1.125rem;
    --sc-text-2xl: 1.25rem;
    --sc-text-3xl: 1.375rem;
    --sc-text-4xl: 1.5rem;
    --sc-text-5xl: 1.75rem;
    --sc-text-6xl: 2rem;
  }
  
  /* Reduce all spacing */
  .sc-section,
  .sc-content-section {
    padding-top: var(--sc-space-6);
    padding-bottom: var(--sc-space-6);
  }
  
  /* Single column everything */
  [class*="grid"],
  [class*="col"] {
    grid-template-columns: 1fr !important;
  }
  
  /* Smaller components */
  .sc-btn {
    padding: var(--sc-space-2) var(--sc-space-4);
    font-size: var(--sc-text-sm);
  }
  
  /* Hide non-essential decorative elements */
  .sc-page-hero__grid,
  .sc-page-hero__gradient,
  .grid-3d,
  .floating-metric,
  .floating-badge,
  .pulse-ring,
  .glow-effect {
    display: none;
  }
  
  /* Simplify hero */
  .sc-page-hero {
    min-height: 50vh;
    padding: var(--sc-space-12) 0;
  }
}

/* Content Responsive Styles
   ----------------------------------------- */
@media (max-width: 768px) {
  /* Universal content grids */
  .sc-content-grid--2col,
  .sc-content-grid--3col,
  .sc-content-grid--4col,
  .sc-content-grid--sidebar,
  .sc-content-grid--sidebar-right {
    grid-template-columns: 1fr;
  }
  
  /* Feature rows */
  .sc-feature-row {
    grid-template-columns: 1fr;
    gap: var(--sc-space-6);
  }
  
  /* Stats grids */
  .sc-stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--sc-space-4);
  }
  
  /* Philosophy/About grids */
  .sc-philosophy-grid {
    grid-template-columns: 1fr;
  }
  
  /* Contact forms */
  .sc-contact-grid {
    grid-template-columns: 1fr;
  }
  
  /* Documentation layout */
  .sc-docs-layout {
    grid-template-columns: 1fr;
  }
  
  .sc-docs-sidebar {
    position: static;
    margin-bottom: var(--sc-space-8);
  }
  
  /* Case study layout */
  .sc-case-study__overview {
    grid-template-columns: 1fr;
  }
  
  /* Dashboard grids */
  .sc-dashboard-grid__item,
  .sc-dashboard-grid__item--half,
  .sc-dashboard-grid__item--third,
  .sc-dashboard-grid__item--quarter {
    grid-column: span 12;
  }
  
  /* Dashboard scaling */
  .sales-dashboard,
  .patient-dashboard,
  .server-dashboard,
  .student-analytics,
  .trading-dashboard,
  .ehr-dashboard {
    /* transform: scale(0.8); */
    margin: 0 -2rem;
  }
  
  /* Performance sections */
  .performance-section,
  .security-section,
  .analytics-section {
    grid-template-columns: 1fr;
    gap: var(--sc-space-6);
  }
  
  /* Stats and metrics */
  .infrastructure-stats,
  .server-metrics,
  .compliance-features,
  .trading-metrics {
    grid-template-columns: 1fr;
    text-align: center;
  }
  
  /* Interactive components */
  .game-server-grid,
  .course-grid,
  .integration-grid {
    grid-template-columns: 1fr;
  }
  
  /* Floating elements */
  .floating-metric,
  .floating-badge {
    display: none;
  }
  
  /* Hero animations - reduce on mobile */
  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }
  
  /* Reduce particle effects on mobile */
  .grid-particle {
    display: none;
  }
  
  /* Feature cards */
  .feature-card,
  .solution-card,
  .capability-card {
    padding: var(--sc-space-4);
  }
  
  /* CTA sections */
  .cta-section h2 {
    font-size: var(--sc-text-3xl);
  }
  
  .cta-buttons {
    flex-direction: column;
    gap: var(--sc-space-3);
  }
}

@media (max-width: 480px) {
  /* Further dashboard scaling */
  .sales-dashboard,
  .patient-dashboard,
  .server-dashboard,
  .student-analytics,
  .trading-dashboard,
  .ehr-dashboard {
    /* transform: scale(0.65); */
    margin: 0 -3rem;
  }
  
  /* Hide complex animations on very small screens */
  .pulse-ring,
  .glow-effect,
  .gradient-animation {
    animation: none;
  }
  
  /* Simplify backgrounds */
  .ecommerce-hero::before,
  .healthcare-hero::before,
  .gaming-hero::before,
  .education-hero::before {
    animation: none;
    opacity: 0.3;
  }
  
  /* 3D grid adjustments */
  .grid-3d {
    opacity: 0.4;
    background-size: 40px 40px;
  }
}

/* Print Styles
   ----------------------------------------- */
@media print {
  /* Hide non-essential elements */
  .sc-nav,
  .sc-footer,
  .sc-btn,
  .sc-video,
  .sc-hero__bg {
    display: none !important;
  }
  
  /* Reset colors for print */
  body {
    background: white;
    color: black;
  }
  
  /* Ensure text is readable */
  * {
    color: black !important;
    background: transparent !important;
  }
  
  /* Page breaks */
  .sc-section {
    page-break-inside: avoid;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
}

/* High DPI Displays
   ----------------------------------------- */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
  /* Sharper borders and shadows */
  .sc-card {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 
                0 1px 2px rgba(0, 0, 0, 0.24);
  }
}

/* Reduced Motion
   ----------------------------------------- */
@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;
  }
}

/* Dark Mode Support (if system preference)
   ----------------------------------------- */
@media (prefers-color-scheme: dark) {
  /* Already dark by default, but we can add overrides here if needed */
}

/* Hover Support Detection
   ----------------------------------------- */
@media (hover: hover) and (pointer: fine) {
  /* Enable hover effects only on devices that support it */
  .sc-card--interactive:hover {
    /* No movement on hover for enterprise feel */
  }
  
  .sc-btn:hover {
    /* No movement on hover for enterprise feel */
  }
}

/* Touch Device Adjustments
   ----------------------------------------- */
@media (hover: none) and (pointer: coarse) {
  /* Larger tap targets */
  .sc-btn {
    min-height: 44px;
    padding: var(--sc-space-3) var(--sc-space-6);
  }
  
  /* Remove hover effects */
  .sc-card--interactive:hover {
    transform: none;
  }
}