/* ========================================
   Professional Responsive Design System
   Complete Mobile-First Implementation
   ======================================== */

/* ========================================
   1. FOUNDATION - Reset & Base Styles
   ======================================== */

/* Box sizing for all elements */
*, *::before, *::after {
  box-sizing: border-box;
}

/* Prevent text size adjustment on orientation change */
html {
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* Smooth scrolling with reduced motion support */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* Body overflow prevention */
body {
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
}

/* ========================================
   2. RESPONSIVE IMAGES & MEDIA
   ======================================== */

/* Responsive images by default */
img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Maintain aspect ratio for images */
img {
  object-fit: cover;
}

/* Responsive iframe */
iframe {
  max-width: 100%;
  border: 0;
}

/* ========================================
   3. TYPOGRAPHY SYSTEM
   ======================================== */

/* Mobile First Typography */
h1, .h1 {
  font-size: clamp(1.875rem, 5vw, 3.75rem); /* 30px - 60px */
  line-height: 1.2;
  margin-bottom: 1rem;
}

h2, .h2 {
  font-size: clamp(1.5rem, 4vw, 3rem); /* 24px - 48px */
  line-height: 1.3;
  margin-bottom: 0.875rem;
}

h3, .h3 {
  font-size: clamp(1.25rem, 3vw, 2.25rem); /* 20px - 36px */
  line-height: 1.4;
  margin-bottom: 0.75rem;
}

h4, .h4 {
  font-size: clamp(1.125rem, 2.5vw, 1.875rem); /* 18px - 30px */
  line-height: 1.4;
}

h5, .h5 {
  font-size: clamp(1rem, 2vw, 1.5rem); /* 16px - 24px */
  line-height: 1.5;
}

h6, .h6 {
  font-size: clamp(0.875rem, 1.5vw, 1.25rem); /* 14px - 20px */
  line-height: 1.5;
}

p, .body-text {
  font-size: clamp(0.9375rem, 1.5vw, 1.125rem); /* 15px - 18px */
  line-height: 1.6;
  margin-bottom: 1rem;
}

/* ========================================
   4. LAYOUT SYSTEM
   ======================================== */

/* Container with fluid padding */
.container-responsive {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: clamp(1rem, 5vw, 3rem);
  padding-right: clamp(1rem, 5vw, 3rem);
  max-width: 1920px;
}

/* Section spacing */
.section-padding {
  padding-top: clamp(2.5rem, 8vw, 6rem);
  padding-bottom: clamp(2.5rem, 8vw, 6rem);
}

/* Flex utilities */
.flex-responsive {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(1rem, 3vw, 2rem);
}

/* ========================================
   5. GRID SYSTEM - Mobile First
   ======================================== */

/* Base grid */
.grid-responsive {
  display: grid;
  gap: clamp(1rem, 3vw, 2rem);
  grid-template-columns: 1fr;
}

/* 2 columns on larger phones */
@media (min-width: 480px) {
  .grid-responsive-sm-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 2-3 columns on tablets */
@media (min-width: 768px) {
  .grid-responsive-md-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-responsive-md-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 3-4 columns on desktop */
@media (min-width: 1024px) {
  .grid-responsive-lg-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-responsive-lg-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========================================
   6. BUTTON SYSTEM
   ======================================== */

/* Responsive buttons */
button, .btn {
  padding: clamp(0.625rem, 2vw, 0.875rem) clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(0.875rem, 1.5vw, 1rem);
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  min-height: 44px; /* Touch target size */
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Touch-friendly links */
a {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
}

/* ========================================
   7. FORM ELEMENTS
   ======================================== */

/* Responsive form inputs */
input, textarea, select {
  width: 100%;
  padding: clamp(0.625rem, 2vw, 0.875rem) clamp(0.875rem, 2.5vw, 1.25rem);
  font-size: 16px; /* Prevent zoom on iOS */
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  transition: border-color 0.3s ease;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--color-primary, #003876);
  box-shadow: 0 0 0 3px rgba(0, 56, 118, 0.1);
}

/* ========================================
   8. CARD COMPONENT
   ======================================== */

.card-responsive {
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: clamp(0.75rem, 2vw, 1.5rem);
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-responsive:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

/* ========================================
   9. NAVIGATION RESPONSIVE
   ======================================== */

/* Desktop navigation */
@media (min-width: 1280px) {
  .nav-desktop {
    display: flex;
  }
  
  .nav-mobile {
    display: none;
  }
}

/* Mobile navigation */
@media (max-width: 1279px) {
  .nav-desktop {
    display: none;
  }
  
  .nav-mobile {
    display: block;
  }
}

/* ========================================
   10. RESPONSIVE UTILITIES
   ======================================== */

/* Hide on mobile */
@media (max-width: 767px) {
  .hide-mobile {
    display: none !important;
  }
}

/* Hide on tablet */
@media (min-width: 768px) and (max-width: 1023px) {
  .hide-tablet {
    display: none !important;
  }
}

/* Hide on desktop */
@media (min-width: 1024px) {
  .hide-desktop {
    display: none !important;
  }
}

/* Show only on mobile */
.show-mobile {
  display: none;
}

@media (max-width: 767px) {
  .show-mobile {
    display: block !important;
  }
}

/* ========================================
   11. TEXT UTILITIES
   ======================================== */

/* Text truncation */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-truncate-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 2;
}

.text-truncate-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-clamp: 3;
}

/* Responsive text alignment */
.text-center-mobile {
  text-align: center;
}

@media (min-width: 768px) {
  .text-center-mobile {
    text-align: left;
  }
}

/* ========================================
   12. SPACING SYSTEM
   ======================================== */

/* Responsive margin/padding utilities */
.spacing-sm {
  padding: clamp(1rem, 3vw, 1.5rem);
}

.spacing-md {
  padding: clamp(1.5rem, 4vw, 2.5rem);
}

.spacing-lg {
  padding: clamp(2rem, 5vw, 4rem);
}

.spacing-xl {
  padding: clamp(3rem, 8vw, 6rem);
}

/* ========================================
   13. HERO SECTION RESPONSIVE
   ======================================== */

.hero-responsive {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(2rem, 5vw, 4rem);
}

@media (max-width: 640px) {
  .hero-responsive {
    min-height: 80vh;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .hero-responsive {
    min-height: 100vh;
  }
}

/* ========================================
   14. MODAL/DIALOG RESPONSIVE
   ======================================== */

.modal-responsive {
  width: min(90vw, 600px);
  max-height: 90vh;
  overflow-y: auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: clamp(0.75rem, 2vw, 1.5rem);
}

@media (max-width: 640px) {
  .modal-responsive {
    width: 95vw;
    max-height: 95vh;
    padding: 1.5rem;
    border-radius: 1rem;
  }
}

/* ========================================
   15. TABLE RESPONSIVE
   ======================================== */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
  .table-responsive table {
    min-width: 600px;
  }
  
  .table-responsive::-webkit-scrollbar {
    height: 8px;
  }
  
  .table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
  }
}

/* ========================================
   16. FOOTER RESPONSIVE
   ======================================== */

.footer-responsive .footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 640px) {
  .footer-responsive .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-responsive .footer-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ========================================
   17. PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* Will-change for animations */
.will-animate {
  will-change: transform;
}

/* GPU acceleration */
.gpu-accelerate {
  transform: translateZ(0);
  backface-visibility: hidden;
}

/* ========================================
   18. ACCESSIBILITY
   ======================================== */

/* Focus visible for keyboard navigation */
:focus-visible {
  outline: 2px solid var(--color-primary, #003876);
  outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary, #003876);
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}

.skip-to-content:focus {
  top: 0;
}

/* ========================================
   19. PRINT STYLES
   ======================================== */

@media print {
  body {
    background: white !important;
    color: black !important;
  }
  
  header, footer, nav, .no-print {
    display: none !important;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  @page {
    margin: 2cm;
  }
}

/* ========================================
   20. LANDSCAPE ORIENTATION
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
  section {
    padding-top: 1.5rem !important;
    padding-bottom: 1.5rem !important;
  }
  
  .hero-responsive {
    min-height: 100vh;
  }
}

/* ========================================
   END OF RESPONSIVE SYSTEM
   ======================================== */
