/**
 * GiftCal Web - Estilos Globales
 * Consistente con el diseño de la app móvil
 */

/* ===== Variables CSS ===== */
:root {
  /* Colores principales (de la app) */
  --primary: #0A74FF;
  --primary-dark: #0A5AE0;
  --primary-light: #4DA3FF;
  --secondary: #FF9500;
  --secondary-dark: #CC7600;
  --accent-warm: #FFB347;
  --accent-coral: #FF7B54;
  --accent-teal: #26C6DA;
  --cream: #FFF7EE;
  --sand: #F7E7D7;
  --paper: #FFFBF6;
  --mist: #F3F5FF;
  --ink: #1B1B1F;

  /* Colores de texto */
  --text-primary: #1C1C1E;
  --text-secondary: #6C6C70;
  --text-muted: #8E8E93;
  --text-inverse: #FFFFFF;

  /* Colores de fondo */
  --bg-primary: #FFFFFF;
  --bg-secondary: #F2F2F7;
  --bg-tertiary: #E5E5EA;

  /* Estados */
  --success: #34C759;
  --warning: #FF9500;
  --error: #FF3B30;
  --info: #5856D6;

  /* Sombras */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
  --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.2);

  /* Bordes */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Espaciado */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* Tipografía */
  --font-family: 'Manrope', 'Segoe UI', sans-serif;
  --display-font: 'Fraunces', 'Space Grotesk', 'Manrope', sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-md: 16px;
  --font-size-lg: 18px;
  --font-size-xl: 20px;
  --font-size-2xl: 24px;
  --font-size-3xl: 32px;
  --font-size-4xl: 40px;
  --font-size-5xl: 48px;

  /* Anchos máximos */
  --max-width-sm: 640px;
  --max-width-md: 768px;
  --max-width-lg: 1024px;
  --max-width-xl: 1280px;

  /* Transiciones */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-md);
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-dark);
}

/* ===== Tipografía ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
  font-family: var(--display-font);
}

h1 { font-size: var(--font-size-5xl); }
h2 { font-size: var(--font-size-4xl); }
h3 { font-size: var(--font-size-3xl); }
h4 { font-size: var(--font-size-2xl); }
h5 { font-size: var(--font-size-xl); }
h6 { font-size: var(--font-size-lg); }

p {
  margin-bottom: var(--space-md);
}

.text-muted {
  color: var(--text-muted);
}

.text-secondary {
  color: var(--text-secondary);
}

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

/* ===== Layout ===== */
.container {
  width: 100%;
  max-width: var(--max-width-xl);
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.container-sm {
  max-width: var(--max-width-sm);
}

.container-md {
  max-width: var(--max-width-md);
}

.container-lg {
  max-width: var(--max-width-lg);
}

section {
  padding: var(--space-3xl) 0;
}

/* ===== Navbar ===== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bg-tertiary);
  padding: var(--space-md) 0;
}

.navbar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-weight: 700;
  font-size: var(--font-size-xl);
  color: var(--text-primary);
}

.navbar-logo img {
  width: 36px;
  height: 36px;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  list-style: none;
}

.navbar-nav a {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.navbar-nav a:hover,
.navbar-nav a.active {
  color: var(--primary);
}

.navbar-cta {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

/* Mobile menu toggle */
.navbar-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.navbar-toggle ion-icon {
  font-size: 24px;
  color: var(--text-primary);
}

/* ===== Botones ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-md);
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--accent-teal));
  color: var(--text-inverse);
  box-shadow: 0 12px 24px rgba(10, 116, 255, 0.2);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: var(--text-inverse);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--text-inverse);
}

.btn-secondary:hover {
  background: var(--secondary-dark);
  color: var(--text-inverse);
}

.btn-outline {
  background: transparent;
  border: 2px solid rgba(10, 116, 255, 0.3);
  color: var(--primary-dark);
}

.btn-outline:hover {
  background: var(--primary);
  color: var(--text-inverse);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.btn-lg {
  padding: var(--space-md) var(--space-xl);
  font-size: var(--font-size-lg);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100%;
}

/* ===== Cards ===== */
.card {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.card-body {
  padding: var(--space-lg);
}

.card-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* ===== Grid ===== */
.grid {
  display: grid;
  gap: var(--space-lg);
}

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

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

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

/* ===== Flex utilities ===== */
.flex {
  display: flex;
}

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

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

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

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

/* ===== Footer ===== */
.footer {
  background: var(--text-primary);
  color: var(--text-inverse);
  padding: var(--space-3xl) 0 var(--space-lg);
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.footer-brand p {
  color: var(--text-muted);
  margin-top: var(--space-md);
  max-width: 300px;
}

.footer-title {
  font-size: var(--font-size-md);
  font-weight: 600;
  margin-bottom: var(--space-md);
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: var(--space-sm);
}

.footer-links a {
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.footer-link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--text-muted);
  font: inherit;
  cursor: pointer;
  transition: color var(--transition-fast);
}

.footer-links a:hover {
  color: var(--text-inverse);
}

.footer-link-button:hover {
  color: var(--text-inverse);
}

.footer-social {
  display: flex;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

.footer-social a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  color: var(--text-inverse);
  transition: background var(--transition-fast);
}

.footer-social a:hover {
  background: var(--primary);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: var(--font-size-sm);
  color: var(--text-muted);
}

.footer-legal {
  display: flex;
  gap: var(--space-lg);
}

.footer-legal a {
  color: var(--text-muted);
}

.footer-legal .footer-link-button {
  color: var(--text-muted);
}

.footer-legal a:hover {
  color: var(--text-inverse);
}

.footer-legal .footer-link-button:hover {
  color: var(--text-inverse);
}

/* ===== Forms ===== */
.form-group {
  margin-bottom: var(--space-md);
}

.form-label {
  display: block;
  margin-bottom: var(--space-xs);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--font-size-md);
  font-family: inherit;
  border: 2px solid var(--bg-tertiary);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* ===== Badge ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-xs) var(--space-sm);
  font-size: var(--font-size-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background: rgba(0, 122, 255, 0.1);
  color: var(--primary);
}

.badge-secondary {
  background: rgba(255, 149, 0, 0.1);
  color: var(--secondary);
}

.badge-success {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success);
}

/* ===== Alert ===== */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.alert-success {
  background: rgba(52, 199, 89, 0.1);
  color: var(--success);
  border: 1px solid var(--success);
}

.alert-error {
  background: rgba(255, 59, 48, 0.1);
  color: var(--error);
  border: 1px solid var(--error);
}

.alert-warning {
  background: rgba(255, 149, 0, 0.1);
  color: var(--warning);
  border: 1px solid var(--warning);
}

.alert-info {
  background: rgba(88, 86, 214, 0.1);
  color: var(--info);
  border: 1px solid var(--info);
}

/* ===== Loading ===== */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: var(--space-3xl) var(--space-md);
}

.empty-state ion-icon {
  font-size: 64px;
  color: var(--text-muted);
  margin-bottom: var(--space-md);
}

.empty-state h3 {
  margin-bottom: var(--space-sm);
}

.empty-state p {
  color: var(--text-muted);
  max-width: 300px;
  margin: 0 auto;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 768px) {
  h1 { font-size: var(--font-size-4xl); }
  h2 { font-size: var(--font-size-3xl); }
  h3 { font-size: var(--font-size-2xl); }

  section {
    padding: var(--space-2xl) 0;
  }

  .navbar-nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    flex-direction: column;
    padding: var(--space-md);
    gap: var(--space-sm);
    border-bottom: 1px solid var(--bg-tertiary);
  }

  .navbar-nav.active {
    display: flex;
  }

  .navbar-toggle {
    display: block;
  }

  .navbar-cta {
    display: none;
  }

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

  .footer-content {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .footer-brand p {
    margin: var(--space-md) auto;
  }

  .footer-social {
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    gap: var(--space-md);
    text-align: center;
  }

  .footer-legal {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ===== Utilidades de espaciado ===== */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.pt-sm { padding-top: var(--space-sm); }
.pt-md { padding-top: var(--space-md); }
.pt-lg { padding-top: var(--space-lg); }
.pt-xl { padding-top: var(--space-xl); }

.pb-sm { padding-bottom: var(--space-sm); }
.pb-md { padding-bottom: var(--space-md); }
.pb-lg { padding-bottom: var(--space-lg); }
.pb-xl { padding-bottom: var(--space-xl); }

/* ===== Visibilidad ===== */
.hidden {
  display: none !important;
}

/* ===== Cookie Banner ===== */
.cookie-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2000;
  background: #1B1B1F;
  color: #fff;
  padding: 18px 20px;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
}

.cookie-banner__content {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.cookie-banner__text {
  max-width: 680px;
}

.cookie-banner__text strong {
  display: block;
  font-size: 16px;
  margin-bottom: 6px;
}

.cookie-banner__text p {
  margin: 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.78);
}

.cookie-banner__text a {
  color: #fff;
  text-decoration: underline;
}

.cookie-banner__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.cookie-banner .btn-ghost {
  color: #fff;
}

.cookie-banner .btn-outline {
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
}

.cookie-banner .btn-outline:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

/* ===== Cookie Modal ===== */
.cookie-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cookie-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 18, 0.6);
}

.cookie-modal__panel {
  position: relative;
  z-index: 1;
  width: min(600px, 92vw);
  background: #fff;
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.cookie-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cookie-modal__header h3 {
  font-size: 22px;
}

.cookie-modal__close {
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
}

.cookie-modal__body {
  display: grid;
  gap: 14px;
}

.cookie-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--bg-tertiary);
  background: var(--bg-secondary);
}

.cookie-option p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
}

.cookie-option__badge {
  font-size: 12px;
  font-weight: 600;
  color: #0A5AE0;
  background: rgba(10, 90, 224, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.cookie-toggle {
  position: relative;
  width: 46px;
  height: 26px;
}

.cookie-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.cookie-toggle__slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(27, 27, 31, 0.2);
  border-radius: 999px;
  transition: background var(--transition-fast);
}

.cookie-toggle__slider::before {
  content: '';
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.cookie-toggle input:checked + .cookie-toggle__slider {
  background: linear-gradient(135deg, #0A74FF, #26C6DA);
}

.cookie-toggle input:checked + .cookie-toggle__slider::before {
  transform: translateX(20px);
}

.cookie-toggle--disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.cookie-toggle--disabled .cookie-toggle__slider {
  cursor: not-allowed;
}

.cookie-modal__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 18px;
}

.cookie-modal-open {
  overflow: hidden;
}

@media (max-width: 768px) {
  .cookie-banner {
    left: 12px;
    right: 12px;
    bottom: 12px;
    padding: 16px;
  }

  .cookie-modal__panel {
    padding: 16px;
  }

  .cookie-modal__footer {
    justify-content: center;
  }
}

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