/* ===========================
   MOBILE BASE CSS - PlannerMaison
   ===========================
   Sistema base responsive con enfoque mobile-first
   Variables CSS globales y breakpoints estandarizados
   ========================= */

/* ===========================
   CSS CUSTOM PROPERTIES (VARIABLES)
   ========================= */
:root {
  /* Colores principales */
  --primary-blue: #92A4BB;
  --primary-orange: rgb(242, 184, 114);
  --background-cream: #F7F1E3;
  --text-dark: #2c3e50;
  --text-light: #ffffff;
  --text-muted: #6c757d;

  /* Colores de estado */
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;

  /* Tipografía móvil */
  --font-family-primary: 'Roboto Mono', monospace, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-size-xs: 0.75rem;    /* 12px */
  --font-size-sm: 0.875rem;   /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg: 1.125rem;   /* 18px */
  --font-size-xl: 1.25rem;    /* 20px */
  --font-size-2xl: 1.5rem;    /* 24px */
  --font-size-3xl: 1.875rem;  /* 30px */
  --font-size-4xl: 2.25rem;   /* 36px */

  /* Espaciado móvil */
  --spacing-xs: 0.25rem;   /* 4px */
  --spacing-sm: 0.5rem;    /* 8px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */
  --spacing-3xl: 4rem;     /* 64px */

  /* Contenedores móviles */
  --container-padding-mobile: 1rem;   /* 16px */
  --container-padding-tablet: 2rem;   /* 32px */
  --container-padding-desktop: 3rem;  /* 48px */
  --container-max-width: 1200px;

  /* Bordes y radios */
  --border-radius-sm: 0.25rem;  /* 4px */
  --border-radius-md: 0.5rem;   /* 8px */
  --border-radius-lg: 0.75rem;  /* 12px */
  --border-radius-xl: 1rem;     /* 16px */

  /* Sombras */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transiciones */
  --transition-fast: 0.15s ease-in-out;
  --transition-base: 0.3s ease-in-out;
  --transition-slow: 0.5s ease-in-out;

  /* Z-indexes */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
}

/* ===========================
   MOBILE-FIRST RESET
   ========================= */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px; /* Base para rem */
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family-primary);
  font-size: var(--font-size-base);
  line-height: 1.6;
  color: var(--text-dark);
  background-color: var(--background-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Mejorar la accesibilidad en móvil */
a, button, input, textarea, select {
  -webkit-tap-highlight-color: rgba(163, 191, 217, 0.3);
}

/* Touch targets mínimos de 44x44px */
a, button, input[type="button"], input[type="submit"], input[type="reset"] {
  min-height: 44px;
  min-width: 44px;
}

/* Elementos de formulario optimizados para móvil */
input, textarea, select {
  font-size: var(--font-size-base);
  border-radius: var(--border-radius-md);
  border: 2px solid #e9ecef;
  padding: var(--spacing-sm) var(--spacing-md);
  transition: all var(--transition-base);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(163, 191, 217, 0.1);
}

/* ===========================
   SISTEMA DE GRID RESPONSIVE
   ========================= */

/* Container base mobile-first */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding-mobile);
}

/* Grid flexible */
.grid {
  display: grid;
  gap: var(--spacing-md);
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; } /* Mobile first: single column */
.grid-3 { grid-template-columns: 1fr; } /* Mobile first: single column */
.grid-4 { grid-template-columns: 1fr; } /* Mobile first: single column */

/* Flex utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-wrap { flex-wrap: wrap; }
.flex-nowrap { flex-wrap: nowrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }

/* ===========================
   BREAKPOINTS ESTANDARIZADOS
   ========================= */

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) {
  .container {
    padding: 0 var(--container-padding-mobile);
  }

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

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
  :root {
    --font-size-xs: 0.8125rem;  /* 13px */
    --font-size-sm: 0.9375rem;  /* 15px */
    --font-size-base: 1.0625rem; /* 17px */
    --font-size-lg: 1.1875rem;  /* 19px */
    --font-size-xl: 1.375rem;   /* 22px */
    --font-size-2xl: 1.625rem;  /* 26px */
    --font-size-3xl: 2rem;      /* 32px */
    --font-size-4xl: 2.5rem;    /* 40px */
  }

  .container {
    padding: 0 var(--container-padding-tablet);
  }

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

  /* Tablet-specific utilities */
  .tablet\:grid-2 { grid-template-columns: repeat(2, 1fr); }
  .tablet\:flex-row { flex-direction: row; }
  .tablet\:hidden { display: none; }
  .tablet\:block { display: block; }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
  .container {
    padding: 0 var(--container-padding-desktop);
  }

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

  /* Desktop-specific utilities */
  .desktop\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .desktop\:grid-4 { grid-template-columns: repeat(4, 1fr); }
  .desktop\:flex-row { flex-direction: row; }
  .desktop\:hidden { display: none; }
  .desktop\:block { display: block; }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
  .container {
    padding: 0 var(--container-padding-desktop);
  }
}

/* ===========================
   UTILIDADES MÓVILES
   ========================= */

/* Espaciado responsive */
.p-xs { padding: var(--spacing-xs); }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.m-xs { margin: var(--spacing-xs); }
.m-sm { margin: var(--spacing-sm); }
.m-md { margin: var(--spacing-md); }
.m-lg { margin: var(--spacing-lg); }
.m-xl { margin: var(--spacing-xl); }

/* Texto responsive */
.text-xs { font-size: var(--font-size-xs); }
.text-sm { font-size: var(--font-size-sm); }
.text-base { font-size: var(--font-size-base); }
.text-lg { font-size: var(--font-size-lg); }
.text-xl { font-size: var(--font-size-xl); }
.text-2xl { font-size: var(--font-size-2xl); }
.text-3xl { font-size: var(--font-size-3xl); }
.text-4xl { font-size: var(--font-size-4xl); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

/* Visibilidad responsive */
.mobile\:hidden { display: none; }
.mobile\:block { display: block; }

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

/* Estados de carga y interacción */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

.disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* ===========================
   COMPONENTES BASE MÓVILES
   ========================= */

/* Botones touch-friendly */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: var(--spacing-sm) var(--spacing-lg);
  border: 2px solid transparent;
  border-radius: var(--border-radius-md);
  font-size: var(--font-size-base);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.btn-primary {
  background-color: var(--primary-blue);
  color: var(--text-light);
  border-color: var(--primary-blue);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: #8db4d6;
  border-color: #8db4d6;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: var(--primary-orange);
  color: var(--text-light);
  border-color: var(--primary-orange);
}

.btn-secondary:hover, .btn-secondary:focus {
  background-color: #ff5a3d;
  border-color: #ff5a3d;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Cards responsive */
.card {
  background: var(--background-cream);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-base);
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Imágenes responsive */
.img-responsive {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius-md);
}

/* ===========================
   ACCESIBILIDAD MÓVIL
   ========================= */

/* Skip link para navegación por teclado */
.skip-link {
  position: absolute;
  top: -40px;
  left: 6px;
  background: var(--primary-blue);
  color: var(--text-light);
  padding: 8px;
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  z-index: var(--z-tooltip);
}

.skip-link:focus {
  top: 6px;
}

/* Focus visible mejorado */
*:focus-visible {
  outline: 2px solid var(--primary-blue);
  outline-offset: 2px;
}

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