/* Global Web Styles para SG-PRÉSTAMOS */

/* Reset y Base */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Responsive Container */
.responsive-container {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

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

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

@media (min-width: 992px) {
  .responsive-container {
    max-width: 960px;
    padding-left: 32px;
    padding-right: 32px;
  }
}

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

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

/* Utilidades de Grid Responsivo */
.grid-responsive {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

@media (max-width: 576px) {
  .grid-responsive {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

@media (min-width: 1200px) {
  .grid-responsive {
    gap: 20px;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* Hover effects para cards */
@media (hover: hover) {
  .card-hover {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
  }
  
  .card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  }
}

/* Focus visible mejorado */
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid #007bff;
  outline-offset: 2px;
}

/* Animaciones suaves */
@media (prefers-reduced-motion: no-preference) {
  * {
    scroll-behavior: smooth;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .no-print,
  header,
  nav,
  aside,
  .sidebar {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  a {
    text-decoration: underline;
  }
}

/* Utilidades de visibilidad responsiva */
.show-mobile {
  display: block;
}

.hide-mobile {
  display: none;
}

@media (min-width: 768px) {
  .show-mobile {
    display: none;
  }
  
  .hide-mobile {
    display: block;
  }
}

/* Text utilities */
.text-center {
  text-align: center;
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-wrap {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Spacing utilities responsive */
@media (max-width: 576px) {
  .py-mobile-sm {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  
  .px-mobile-sm {
    padding-left: 12px;
    padding-right: 12px;
  }
}

/* Loading skeleton */
@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

/* Safe area insets para PWA */
@supports (padding: max(0px)) {
  body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
  
  .header-safe-area {
    padding-top: max(16px, env(safe-area-inset-top));
  }
  
  .bottom-safe-area {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

/* Mejoras de accesibilidad */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus trap para modals */
.modal-open {
  overflow: hidden;
}

/* Transition utilities */
.transition-all {
  transition: all 0.3s ease;
}

.transition-transform {
  transition: transform 0.3s ease;
}

.transition-opacity {
  transition: opacity 0.3s ease;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Flexbox utilities */
.flex {
  display: flex;
}

.flex-column {
  flex-direction: column;
}

.flex-center {
  justify-content: center;
  align-items: center;
}

.flex-between {
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

/* Gap utilities */
.gap-1 {
  gap: 8px;
}

.gap-2 {
  gap: 16px;
}

.gap-3 {
  gap: 24px;
}

@media (max-width: 576px) {
  .gap-1 {
    gap: 4px;
  }
  
  .gap-2 {
    gap: 12px;
  }
  
  .gap-3 {
    gap: 16px;
  }
}
