/* ========================================
   RESPONSIVE OPTIMIZATIONS
   Optimizaciones específicas para PC, tablets y móviles
   ======================================== */

/* ========================================
   MOBILE FIRST APPROACH
   ======================================== */

/* Base mobile styles (320px - 767px) */
@media (max-width: 767px) {
  /* Typography scaling for mobile */
  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem);
    line-height: 1.1;
  }
  
  .section-title {
    font-size: clamp(1.75rem, 6vw, 2.5rem);
    line-height: 1.2;
  }
  
  .card-title {
    font-size: clamp(1.25rem, 5vw, 1.5rem);
  }
  
  /* Spacing adjustments for mobile */
  .section {
    padding: clamp(2rem, 8vw, 4rem) 0;
  }
  
  .container {
    padding: clamp(1rem, 4vw, 2rem);
  }
  
  /* Grid adjustments for mobile */
  .grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  /* Button sizing for mobile touch */
  .btn, .cta-button {
    min-height: 48px;
    min-width: 48px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
  
  /* Navigation mobile optimizations */
  .nav-menu {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    transition: left 0.3s ease;
    z-index: 1000;
  }
  
  .nav-menu.active {
    left: 0;
  }
  
  /* Mobile menu items */
  .nav-menu ul {
    flex-direction: column;
    padding: 2rem 1rem;
    gap: 1.5rem;
  }
  
  .nav-menu li {
    width: 100%;
    text-align: center;
  }
  
  .nav-menu a {
    display: block;
    padding: 1rem;
    font-size: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  /* Mobile hamburger menu */
  .hamburger {
    display: block;
    cursor: pointer;
    z-index: 1001;
  }
  
  .hamburger span {
    display: block;
    width: 25px;
    height: 3px;
    background: #333;
    margin: 5px 0;
    transition: 0.3s;
  }
  
  .hamburger.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
  }
  
  .hamburger.active span:nth-child(2) {
    opacity: 0;
  }
  
  .hamburger.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
  }
  
  /* Card optimizations for mobile */
  .card {
    margin: 0 0.5rem;
    border-radius: 1rem;
  }
  
  /* Image optimizations for mobile */
  img {
    max-width: 100%;
    height: auto;
  }
  
  /* Form optimizations for mobile */
  .form-input, .form-select, .form-textarea {
    font-size: 16px; /* Prevents zoom on iOS */
    padding: 0.875rem;
  }
  
  /* Modal optimizations for mobile */
  .modal {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
  }
  
  /* Sticky CTA mobile positioning */
  .sticky-cta {
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    border-radius: 1rem;
  }
  
  /* Footer mobile layout */
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
  }
}

/* ========================================
   MOBILE NAVIGATION SPECIFIC STYLES
   ======================================== */

/* Mobile menu container */
#mobile-menu {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* Mobile submenu transitions */
#mobile-motos-submenu {
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: max-height;
}

/* Mobile menu button states */
#mobile-menu-btn[aria-expanded="true"] {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

/* Mobile menu item hover effects */
#mobile-menu nav a:hover {
  background-color: rgba(239, 68, 68, 0.1);
  border-radius: 0.5rem;
}

/* Mobile submenu button hover */
#mobile-motos-btn:hover {
  background-color: rgba(239, 68, 68, 0.05);
}

/* ========================================
   TABLET OPTIMIZATIONS (768px - 1023px)
   ======================================== */
@media (min-width: 768px) and (max-width: 1023px) {
  /* Typography for tablets */
  .hero-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
  }
  
  .section-title {
    font-size: clamp(2rem, 5vw, 3rem);
  }
  
  /* Grid adjustments for tablets */
  .grid-cols-2 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-cols-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Navigation tablet adjustments */
  .nav-menu {
    position: static;
    background: transparent;
    backdrop-filter: none;
  }
  
  .nav-menu ul {
    flex-direction: row;
    gap: 1rem;
  }
  
  .hamburger {
    display: none;
  }
  
  /* Card layout for tablets */
  .card-grid {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  }
  
  /* Form layout for tablets */
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  /* Footer tablet layout */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
  }
}

/* ========================================
   DESKTOP OPTIMIZATIONS (1024px+)
   ======================================== */
@media (min-width: 1024px) {
  /* Typography for desktop */
  .hero-title {
    font-size: clamp(3rem, 5vw, 5rem);
  }
  
  .section-title {
    font-size: clamp(2.5rem, 4vw, 4rem);
  }
  
  /* Grid for desktop */
  .grid-cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-cols-4 {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Navigation desktop */
  .nav-menu {
    position: static;
    background: transparent;
  }
  
  .nav-menu ul {
    flex-direction: row;
    gap: 2rem;
  }
  
  /* Hover effects for desktop */
  .card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
  }
  
  .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  }
  
  /* Desktop specific layouts */
  .hero-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
  }
  
  .features-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 3rem;
  }
  
  /* Footer desktop layout */
  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 3rem;
  }
}

/* ========================================
   LARGE DESKTOP OPTIMIZATIONS (1280px+)
   ======================================== */
@media (min-width: 1280px) {
  .container {
    max-width: 1200px;
  }
  
  .hero-title {
    font-size: 5rem;
  }
  
  .section-title {
    font-size: 4rem;
  }
  
  /* Enhanced hover effects */
  .card:hover {
    transform: translateY(-12px);
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.2);
  }
  
  /* Large desktop specific spacing */
  .section {
    padding: 6rem 0;
  }
  
  .hero-section {
    min-height: 90vh;
  }
}

/* ========================================
   ULTRA-WIDE OPTIMIZATIONS (1536px+)
   ======================================== */
@media (min-width: 1536px) {
  .container {
    max-width: 1400px;
  }
  
  .hero-title {
    font-size: 6rem;
  }
  
  .section-title {
    font-size: 5rem;
  }
  
  /* Ultra-wide specific layouts */
  .hero-content {
    gap: 6rem;
  }
  
  .features-grid {
    gap: 4rem;
  }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   ======================================== */
@media (hover: none) and (pointer: coarse) {
  /* Remove hover effects on touch devices */
  .card:hover {
    transform: none;
    box-shadow: var(--shadow-lg);
  }
  
  .btn:hover {
    transform: none;
    box-shadow: var(--shadow-md);
  }
  
  /* Increase touch targets */
  .btn, .cta-button, .nav-link {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Add touch feedback */
  .btn:active, .cta-button:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }
  
  /* Optimize scrolling on touch devices */
  .scroll-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }
}

/* ========================================
   HIGH DPI DISPLAYS
   ======================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* High DPI image optimizations */
  .hero-image {
    background-image: url('/images/hero-2x.webp');
  }
  
  .logo {
    background-image: url('/images/logo-2x.webp');
  }
}

/* ========================================
   PRINT OPTIMIZATIONS
   ======================================== */
@media print {
  .no-print {
    display: none !important;
  }
  
  .hero-section {
    min-height: auto;
    background: none !important;
  }
  
  .btn, .cta-button {
    background: none !important;
    color: #000 !important;
    border: 1px solid #000 !important;
  }
  
  .card {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
  }
  
  /* Ensure good contrast for printing */
  body {
    color: #000 !important;
    background: #fff !important;
  }
  
  a {
    color: #000 !important;
    text-decoration: underline !important;
  }
}

/* ========================================
   ACCESSIBILITY IMPROVEMENTS
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .scroll-behavior-smooth {
    scroll-behavior: auto;
  }
}

@media (prefers-contrast: high) {
  .btn, .cta-button {
    border: 2px solid currentColor;
  }
  
  .card {
    border: 2px solid #000;
  }
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */
@media (max-width: 767px) {
  /* Reduce animations on mobile for better performance */
  .animate-fade-in-up {
    animation: none;
    opacity: 1;
    transform: none;
  }
  
  /* Optimize shadows for mobile */
  .card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
  
  /* Reduce backdrop-filter usage on mobile */
  .backdrop-blur {
    backdrop-filter: none;
    background: rgba(255, 255, 255, 0.9);
  }
}

/* ========================================
   ORIENTATION SPECIFIC OPTIMIZATIONS
   ======================================== */
@media (orientation: landscape) and (max-height: 500px) {
  /* Landscape mobile optimizations */
  .hero-section {
    min-height: 100vh;
    padding: 2rem 0;
  }
  
  .hero-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }
  
  .section {
    padding: 2rem 0;
  }
}

@media (orientation: portrait) and (max-width: 767px) {
  /* Portrait mobile optimizations */
  .hero-section {
    min-height: 100vh;
    padding: 4rem 0;
  }
  
  .hero-title {
    font-size: clamp(2rem, 8vw, 3rem);
  }
}

/* ========================================
   UTILITY CLASSES FOR RESPONSIVE DESIGN
   ======================================== */
.responsive-container {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

@media (min-width: 640px) {
  .responsive-container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .responsive-container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .responsive-container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .responsive-container {
    max-width: 1280px;
  }
}

@media (min-width: 1536px) {
  .responsive-container {
    max-width: 1536px;
  }
}

/* ========================================
   RESPONSIVE TYPOGRAPHY SCALE
   ======================================== */
.responsive-text {
  font-size: clamp(1rem, 4vw, 1.5rem);
  line-height: 1.4;
}

.responsive-heading {
  font-size: clamp(1.5rem, 6vw, 3rem);
  line-height: 1.2;
}

.responsive-subheading {
  font-size: clamp(1.25rem, 5vw, 2rem);
  line-height: 1.3;
}

/* ========================================
   RESPONSIVE SPACING SCALE
   ======================================== */
.responsive-section {
  padding: clamp(2rem, 8vw, 6rem) 0;
}

.responsive-container {
  padding: clamp(1rem, 4vw, 2rem);
}

.responsive-gap {
  gap: clamp(1rem, 3vw, 2rem);
}

/* ========================================
   RESPONSIVE GRID SYSTEM
   ======================================== */
.responsive-grid {
  display: grid;
  gap: clamp(1rem, 3vw, 2rem);
}

.responsive-grid-1 {
  grid-template-columns: 1fr;
}

.responsive-grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.responsive-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.responsive-grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

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

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

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