/* =========================================
   ATTON FINANCE - RESPONSIVE DESIGN SYSTEM
   Sistema completo de breakpoints y utilidades
   ========================================= */

/* =================================
   BREAKPOINTS ESTANDARIZADOS
   ================================= */
:root {
  /* Breakpoints consistentes para todo el sitio */
  --breakpoint-xs: 320px;   /* Móviles pequeños */
  --breakpoint-sm: 640px;   /* Móviles grandes */
  --breakpoint-md: 768px;   /* Tablets */
  --breakpoint-lg: 1024px;  /* Tablets landscape / laptops pequeñas */
  --breakpoint-xl: 1280px;  /* Desktop estándar */
  --breakpoint-2xl: 1536px; /* Desktop grande */

  /* Espaciado responsive */
  --container-padding-mobile: 1rem;
  --container-padding-tablet: 1.5rem;
  --container-padding-desktop: 2rem;
}

/* =================================
   CONTENEDORES RESPONSIVE
   ================================= */
.container-responsive {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--container-padding-mobile);
  padding-right: var(--container-padding-mobile);
}

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

@media (min-width: 768px) {
  .container-responsive {
    max-width: 768px;
    padding-left: var(--container-padding-tablet);
    padding-right: var(--container-padding-tablet);
  }
}

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

@media (min-width: 1280px) {
  .container-responsive {
    max-width: 1280px;
    padding-left: var(--container-padding-desktop);
    padding-right: var(--container-padding-desktop);
  }
}

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

/* =================================
   UTILIDADES DE DISPLAY RESPONSIVE
   ================================= */

/* Ocultar elementos por breakpoint */
@media (max-width: 639px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 640px) and (max-width: 767px) {
  .hide-sm { display: none !important; }
}

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

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

/* Mostrar solo en ciertos breakpoints */
.show-mobile-only { display: none !important; }
.show-tablet-only { display: none !important; }
.show-desktop-only { display: none !important; }

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

@media (min-width: 768px) and (max-width: 1023px) {
  .show-tablet-only { display: block !important; }
}

@media (min-width: 1024px) {
  .show-desktop-only { display: block !important; }
}

/* =================================
   GRID SYSTEM RESPONSIVE
   ================================= */
.grid-responsive {
  display: grid;
  gap: 1rem;
}

/* Grid para móviles: 1 columna */
@media (max-width: 639px) {
  .grid-responsive {
    grid-template-columns: 1fr;
  }

  .grid-cols-mobile-1 { grid-template-columns: 1fr; }
  .grid-cols-mobile-2 { grid-template-columns: repeat(2, 1fr); }
}

/* Grid para tablets: 2 columnas por defecto */
@media (min-width: 640px) and (max-width: 1023px) {
  .grid-responsive {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
  }

  .grid-cols-tablet-1 { grid-template-columns: 1fr; }
  .grid-cols-tablet-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-tablet-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Grid para desktop: 3-4 columnas */
@media (min-width: 1024px) {
  .grid-responsive {
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
  }

  .grid-cols-desktop-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-desktop-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-cols-desktop-4 { grid-template-columns: repeat(4, 1fr); }
}

/* =================================
   FLEXBOX RESPONSIVE
   ================================= */
.flex-responsive {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 767px) {
  .flex-responsive {
    flex-direction: column;
  }

  .flex-mobile-row { flex-direction: row !important; }
  .flex-mobile-col { flex-direction: column !important; }
}

@media (min-width: 768px) {
  .flex-responsive {
    flex-direction: row;
  }

  .flex-tablet-row { flex-direction: row !important; }
  .flex-tablet-col { flex-direction: column !important; }
}

/* =================================
   TIPOGRAFÍA RESPONSIVE (Fluid Typography)
   ================================= */
.text-responsive-xs {
  font-size: clamp(0.75rem, 2vw, 0.875rem);
}

.text-responsive-sm {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
}

.text-responsive-base {
  font-size: clamp(1rem, 3vw, 1.125rem);
}

.text-responsive-lg {
  font-size: clamp(1.125rem, 3.5vw, 1.25rem);
}

.text-responsive-xl {
  font-size: clamp(1.25rem, 4vw, 1.5rem);
}

.text-responsive-2xl {
  font-size: clamp(1.5rem, 4.5vw, 2rem);
}

.text-responsive-3xl {
  font-size: clamp(1.875rem, 5vw, 2.5rem);
}

.text-responsive-4xl {
  font-size: clamp(2.25rem, 6vw, 3rem);
}

.text-responsive-5xl {
  font-size: clamp(3rem, 7vw, 4rem);
}

.text-responsive-hero {
  font-size: clamp(2rem, 8vw, 4.5rem);
  line-height: 1.1;
}

/* =================================
   SPACING RESPONSIVE
   ================================= */
.padding-responsive {
  padding: 1rem;
}

@media (min-width: 768px) {
  .padding-responsive {
    padding: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .padding-responsive {
    padding: 2rem;
  }
}

/* Padding vertical responsive */
.py-responsive {
  padding-top: 2rem;
  padding-bottom: 2rem;
}

@media (min-width: 768px) {
  .py-responsive {
    padding-top: 3rem;
    padding-bottom: 3rem;
  }
}

@media (min-width: 1024px) {
  .py-responsive {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
}

/* =================================
   IMÁGENES Y MEDIA RESPONSIVE
   ================================= */
.img-responsive {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

.video-responsive {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
}

.video-responsive iframe,
.video-responsive object,
.video-responsive embed {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

/* =================================
   CARDS RESPONSIVE
   ================================= */
.card-responsive {
  padding: 1rem;
  border-radius: 0.5rem;
}

@media (min-width: 768px) {
  .card-responsive {
    padding: 1.5rem;
    border-radius: 0.75rem;
  }
}

@media (min-width: 1024px) {
  .card-responsive {
    padding: 2rem;
    border-radius: 1rem;
  }
}

/* =================================
   BOTONES RESPONSIVE
   ================================= */
.btn-responsive {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  min-height: 44px; /* Touch target mínimo */
  width: 100%;
}

@media (min-width: 768px) {
  .btn-responsive {
    padding: 1rem 2rem;
    font-size: 1rem;
    width: auto;
    min-width: 200px;
  }
}

/* =================================
   FORMULARIOS RESPONSIVE
   ================================= */
.form-responsive input,
.form-responsive textarea,
.form-responsive select {
  width: 100%;
  padding: 0.75rem;
  font-size: 16px; /* Previene zoom en iOS */
  min-height: 44px;
}

@media (min-width: 768px) {
  .form-responsive input,
  .form-responsive textarea,
  .form-responsive select {
    padding: 1rem;
  }
}

/* =================================
   TABLAS RESPONSIVE
   ================================= */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  min-width: 100%;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .table-responsive table,
  .table-responsive thead,
  .table-responsive tbody,
  .table-responsive th,
  .table-responsive td,
  .table-responsive tr {
    display: block;
  }

  .table-responsive thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .table-responsive tr {
    margin-bottom: 1rem;
    border: 1px solid var(--color-gray-200);
    border-radius: 0.5rem;
    padding: 0.5rem;
  }

  .table-responsive td {
    border: none;
    position: relative;
    padding-left: 50%;
  }

  .table-responsive td:before {
    position: absolute;
    left: 0.5rem;
    width: 45%;
    white-space: nowrap;
    font-weight: 600;
    content: attr(data-label);
  }
}

/* =================================
   NAVEGACIÓN RESPONSIVE
   ================================= */
.nav-responsive {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@media (min-width: 768px) {
  .nav-responsive {
    flex-direction: row;
    gap: 1rem;
    align-items: center;
  }
}

/* Hamburger Menu para móvil */
.hamburger-menu {
  display: block;
  width: 30px;
  height: 24px;
  position: relative;
  cursor: pointer;
  background: transparent;
  border: none;
  padding: 0;
}

.hamburger-menu span {
  display: block;
  position: absolute;
  height: 3px;
  width: 100%;
  background: currentColor;
  border-radius: 3px;
  opacity: 1;
  left: 0;
  transform: rotate(0deg);
  transition: 0.25s ease-in-out;
}

.hamburger-menu span:nth-child(1) {
  top: 0px;
}

.hamburger-menu span:nth-child(2) {
  top: 10px;
}

.hamburger-menu span:nth-child(3) {
  top: 20px;
}

.hamburger-menu.active span:nth-child(1) {
  top: 10px;
  transform: rotate(135deg);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
  left: -60px;
}

.hamburger-menu.active span:nth-child(3) {
  top: 10px;
  transform: rotate(-135deg);
}

@media (min-width: 1024px) {
  .hamburger-menu {
    display: none;
  }
}

/* =================================
   MODAL/OVERLAY RESPONSIVE
   ================================= */
.modal-responsive {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 9999;
}

.modal-content-responsive {
  width: 100%;
  max-width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 0.5rem;
}

@media (min-width: 768px) {
  .modal-content-responsive {
    max-width: 600px;
    border-radius: 1rem;
  }
}

/* =================================
   UTILIDADES DE ALINEACIÓN
   ================================= */
@media (max-width: 767px) {
  .text-mobile-center { text-align: center !important; }
  .text-mobile-left { text-align: left !important; }
  .text-mobile-right { text-align: right !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .text-tablet-center { text-align: center !important; }
  .text-tablet-left { text-align: left !important; }
  .text-tablet-right { text-align: right !important; }
}

@media (min-width: 1024px) {
  .text-desktop-center { text-align: center !important; }
  .text-desktop-left { text-align: left !important; }
  .text-desktop-right { text-align: right !important; }
}

/* =================================
   SCROLL HORIZONTAL PREVENTION
   ================================= */
@media (max-width: 767px) {
  body {
    overflow-x: hidden;
  }

  .overflow-x-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* =================================
   TOUCH TARGETS PARA MÓVIL
   ================================= */
@media (max-width: 767px) {
  button,
  a.btn,
  input[type="submit"],
  input[type="button"],
  .touch-target {
    min-height: 44px;
    min-width: 44px;
  }
}

/* =================================
   ASPECT RATIOS RESPONSIVE
   ================================= */
.aspect-square {
  aspect-ratio: 1 / 1;
}

.aspect-video {
  aspect-ratio: 16 / 9;
}

.aspect-portrait {
  aspect-ratio: 3 / 4;
}

@supports not (aspect-ratio: 1 / 1) {
  .aspect-square {
    position: relative;
    padding-bottom: 100%;
  }

  .aspect-video {
    position: relative;
    padding-bottom: 56.25%;
  }

  .aspect-portrait {
    position: relative;
    padding-bottom: 133.33%;
  }
}

/* =================================
   Z-INDEX LAYERS
   ================================= */
:root {
  --z-dropdown: 100;
  --z-modal: 200;
  --z-overlay: 300;
  --z-notification: 400;
  --z-tooltip: 500;
}

/* =================================
   PRINT STYLES
   ================================= */
@media print {
  .no-print {
    display: none !important;
  }

  .print-break-before {
    page-break-before: always;
  }

  .print-break-after {
    page-break-after: always;
  }
}