/*
 * styles.css — Estilos para la página de instalación PWA de Agromilch (/app)
 * Diseño claro, moderno y llamativo — light mode
 */

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

:root {
  --color-bg:          #f0faf5;
  --color-bg-grad:     linear-gradient(160deg, #d4f0e2 0%, #f0faf5 55%, #ffffff 100%);
  --color-surface:     #ffffff;
  --color-surface2:    #f0faf5;
  --color-accent:      #16a34a;
  --color-accent2:     #15803d;
  --color-accent-glow: rgba(22, 163, 74, 0.22);
  --color-android:     #34a853;
  --color-android2:    #1e8e3e;
  --color-android-glow:rgba(52, 168, 83, 0.28);
  --color-ios:         #007aff;
  --color-ios2:        #0063d1;
  --color-ios-glow:    rgba(0, 122, 255, 0.22);
  --color-text:        #111827;
  --color-muted:       #4b7a5e;
  --color-muted-light: #6b7280;
  --color-border:      rgba(22, 163, 74, 0.18);
  --color-border-ios:  rgba(0, 122, 255, 0.18);
  --radius-card:       22px;
  --radius-btn:        16px;
  --shadow-card:       0 4px 28px rgba(0, 0, 0, 0.08);
  --shadow-btn:        0 4px 18px rgba(22, 163, 74, 0.32);
  --transition:        0.25s ease;
  --font-main:         'Inter', system-ui, sans-serif;
  --font-brand:        'Cinzel Decorative', serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--color-bg-grad);
  background-attachment: fixed;
  color: var(--color-text);
  min-height: 100svh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Utilidad: ocultar secciones ──────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Layout principal ─────────────────────────────────────────── */
.page-wrapper {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/* ── Header / Logo ────────────────────────────────────────────── */
.install-header {
  text-align: center;
  padding-top: 24px;
}

.app-icon {
  width: 100px;
  height: 100px;
  border-radius: 26px;
  box-shadow: 0 6px 28px rgba(22, 163, 74, 0.30), 0 2px 8px rgba(0,0,0,0.10);
  object-fit: cover;
  animation: floatIcon 3.5s ease-in-out infinite;
}

@keyframes floatIcon {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-7px); }
}

.brand-name {
  font-family: var(--font-brand);
  font-size: 1.7rem;
  color: var(--color-accent);
  letter-spacing: 0.05em;
  margin-top: 14px;
  text-shadow: 0 1px 0 rgba(255,255,255,0.8);
}

.brand-tagline {
  font-size: 0.88rem;
  color: var(--color-muted);
  margin-top: 6px;
  font-weight: 500;
}

/* ── Tarjetas / Cards ─────────────────────────────────────────── */
.card {
  width: 100%;
  background: var(--color-surface);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-card);
  padding: 24px 20px;
  box-shadow: var(--shadow-card);
  animation: fadeUp 0.4s ease both;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Android card — borde verde */
.card--android {
  border-color: rgba(52, 168, 83, 0.30);
  box-shadow: 0 4px 28px rgba(52, 168, 83, 0.12);
}

/* iOS card — borde azul */
.card--ios {
  border-color: var(--color-border-ios);
  box-shadow: 0 4px 28px rgba(0, 122, 255, 0.10);
}

.card__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card__title--android { color: var(--color-android2); }
.card__title--ios     { color: var(--color-ios2); }

.card__body {
  font-size: 0.88rem;
  color: var(--color-muted-light);
  line-height: 1.7;
  margin-bottom: 4px;
}

/* ── Botón principal de descarga APK ──────────────────────────── */
.btn-download-apk {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--color-android2), var(--color-android));
  border: none;
  border-radius: var(--radius-btn);
  cursor: pointer;
  box-shadow: 0 4px 20px var(--color-android-glow);
  transition: transform var(--transition), box-shadow var(--transition);
  margin-top: 16px;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.btn-download-apk:hover,
.btn-download-apk:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(52, 168, 83, 0.45);
  outline: none;
}

.btn-download-apk:active {
  transform: translateY(0);
  box-shadow: 0 3px 12px var(--color-android-glow);
}

/* ── Botón de instalación PWA (secundario en Android) ─────────── */
.btn-install {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-android2);
  background: rgba(52, 168, 83, 0.08);
  border: 1.5px solid rgba(52, 168, 83, 0.35);
  border-radius: var(--radius-btn);
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition), transform var(--transition);
  margin-top: 10px;
  text-decoration: none;
}

.btn-install:hover,
.btn-install:focus-visible {
  background: rgba(52, 168, 83, 0.14);
  transform: translateY(-1px);
  outline: none;
}

.btn-install:active {
  transform: translateY(0);
}

.btn-install:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Separador de opciones ────────────────────────────────────── */
.option-divider {
  text-align: center;
  font-size: 0.78rem;
  color: var(--color-muted-light);
  margin: 12px 0 2px;
  position: relative;
}

.option-divider::before,
.option-divider::after {
  content: '';
  display: inline-block;
  width: 28%;
  height: 1px;
  background: rgba(0,0,0,0.10);
  vertical-align: middle;
  margin: 0 8px;
}

/* ── Nota "aún no disponible" (Android sin prompt) ────────────── */
.not-ready-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid rgba(202, 138, 4, 0.30);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.83rem;
  color: #78350f;
  width: 100%;
  animation: fadeUp 0.4s ease both;
  margin-top: 4px;
}

.not-ready-notice .notice-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Instrucciones iOS (inline) ───────────────────────────────── */
.ios-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.ios-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: #f0f6ff;
  border-radius: 14px;
  padding: 14px 14px;
}

.step-num {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-ios2), var(--color-ios));
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  box-shadow: 0 2px 8px var(--color-ios-glow);
}

.step-text {
  font-size: 0.88rem;
  color: #1f2937;
  line-height: 1.55;
}

.step-text strong {
  color: #111827;
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
}

.step-icon {
  display: inline-block;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 0.9rem;
  vertical-align: middle;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── Sección de beneficios ────────────────────────────────────── */
.benefits-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.benefit-item {
  background: var(--color-surface);
  border: 1.5px solid rgba(22, 163, 74, 0.14);
  border-radius: 16px;
  padding: 16px 10px;
  text-align: center;
  animation: fadeUp 0.5s ease both;
  box-shadow: 0 2px 12px rgba(0,0,0,0.05);
}

.benefit-item:nth-child(2) { animation-delay: 0.05s; }
.benefit-item:nth-child(3) { animation-delay: 0.10s; }
.benefit-item:nth-child(4) { animation-delay: 0.15s; }

.benefit-icon {
  font-size: 1.9rem;
  display: block;
  margin-bottom: 6px;
}

.benefit-text {
  font-size: 0.78rem;
  color: #4b7a5e;
  font-weight: 600;
}

/* ── Sección "ya instalada" ───────────────────────────────────── */
.installed-card {
  text-align: center;
}

.installed-card .check-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 12px;
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes popIn {
  from { transform: scale(0.3); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.installed-card h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-accent);
  margin-bottom: 8px;
}

.installed-card p {
  font-size: 0.9rem;
  color: var(--color-muted-light);
}

/* ── Modal de instrucciones iOS (fallback) ────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  padding: 0 8px 8px;
}

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

.modal-sheet {
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 24px 24px 18px 18px;
  padding: 28px 22px 32px;
  width: 100%;
  max-width: 480px;
  transform: translateY(60px);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90svh;
  overflow-y: auto;
  box-shadow: 0 -4px 32px rgba(0,0,0,0.12);
}

.modal-overlay.active .modal-sheet {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}

.btn-close {
  background: #f3f4f6;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: #6b7280;
  line-height: 1;
  padding: 6px 8px;
  border-radius: 10px;
  transition: background var(--transition);
}

.btn-close:hover {
  background: #e5e7eb;
}

/* ── Sección desktop ──────────────────────────────────────────── */
.desktop-hint {
  text-align: center;
  padding: 8px 0;
}

.desktop-hint .big-emoji {
  font-size: 2.8rem;
  display: block;
  margin-bottom: 10px;
}

.desktop-hint h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 8px;
}

.desktop-hint p {
  font-size: 0.88rem;
  color: var(--color-muted-light);
  line-height: 1.65;
}

.qr-placeholder {
  margin: 18px auto 0;
  width: 120px;
  height: 120px;
  border: 2px dashed rgba(22, 163, 74, 0.25);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #a7c4b2;
}

/* ── Botones futuros de tiendas (ocultos) ─────────────────────── */
.store-buttons {
  display: none;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin-top: 8px;
}

.btn-store {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px 20px;
  border-radius: var(--radius-btn);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1.5px solid var(--color-border);
  background: var(--color-surface2);
  color: var(--color-muted);
  cursor: not-allowed;
  opacity: 0.65;
  text-decoration: none;
}

/* ── Footer ───────────────────────────────────────────────────── */
.install-footer {
  text-align: center;
  font-size: 0.78rem;
  color: #9ca3af;
  padding-bottom: 8px;
}

.install-footer a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

/* ── Responsive: tablets y desktop ───────────────────────────── */
@media (min-width: 600px) {
  .page-wrapper {
    padding: 48px 24px 72px;
  }

  .app-icon {
    width: 116px;
    height: 116px;
  }

  .brand-name {
    font-size: 1.95rem;
  }

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

  .modal-overlay {
    align-items: center;
    padding: 24px;
  }

  .modal-sheet {
    border-radius: 24px;
  }
}
