/* ===================================================
   SOMBRA URBANA INTELIGENTE — Global Styles
   Paleta: Verde esmeralda + Naranja solar + Dark
   =================================================== */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
  --green:       #10b981;
  --green-light: #34d399;
  --green-dark:  #059669;
  --orange:      #f59e0b;
  --orange-light:#fbbf24;
  --blue:        #3b82f6;
  --bg:          #0a0f1e;
  --bg2:         #111827;
  --bg3:         #1f2937;
  --card:        rgba(31, 41, 55, 0.85);
  --border:      rgba(255,255,255,0.08);
  --text:        #f3f4f6;
  --text-muted:  #9ca3af;
  --radius:      16px;
  --shadow:      0 8px 32px rgba(0,0,0,0.4);
  --transition:  all 0.3s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* ── Background animated gradient ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(16,185,129,0.15) 0%, transparent 60%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(245,158,11,0.12) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
  animation: pulseBg 12s infinite alternate ease-in-out;
}

@keyframes pulseBg {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

/* =========================================
   NAV
   ========================================= */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: rgba(10,15,30,0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.navbar .brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--orange), var(--green));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}

.brand-text {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.brand-text span {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 0.5rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: 'Poppins', sans-serif;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.nav-btn.outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.nav-btn.outline:hover { color: var(--text); border-color: var(--green); background: rgba(16,185,129,0.08); }

.nav-btn.primary {
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
}
.nav-btn.primary:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(16,185,129,0.35); }

/* =========================================
   HERO / HEADER
   ========================================= */
.hero {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 5rem 1.5rem 3rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.3);
  color: var(--orange-light);
  padding: 0.35rem 1rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, #fff 0%, var(--green-light) 50%, var(--orange-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto;
}

/* =========================================
   CARD BASE
   ========================================= */
.card {
  position: relative;
  z-index: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  padding: 2rem;
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.card-icon.green  { background: rgba(16,185,129,0.15); }
.card-icon.orange { background: rgba(245,158,11,0.15); }
.card-icon.blue   { background: rgba(59,130,246,0.15); }
.card-icon.purple { background: rgba(139,92,246,0.15); }

.card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* =========================================
   FORM STYLES
   ========================================= */
.survey-container {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 1.5rem 4rem;
}

.form-section {
  margin-bottom: 1.5rem;
}

.step-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green-light);
  margin-bottom: 1.2rem;
}

.step-label::before {
  content: '';
  display: inline-block;
  width: 20px;
  height: 2px;
  background: var(--green-light);
  border-radius: 2px;
}

.question-text {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.question-num {
  display: inline-block;
  background: linear-gradient(135deg, var(--green-dark), var(--green));
  color: #fff;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  text-align: center;
  line-height: 26px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-right: 0.5rem;
  flex-shrink: 0;
}

/* Grid inputs */
.input-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
}

.field-group input,
.field-group select {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.05);
  color: var(--text);
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

.field-group input:focus,
.field-group select:focus {
  border-color: var(--green);
  background: rgba(16,185,129,0.07);
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}

.field-group select option {
  background: var(--bg2);
  color: var(--text);
}

/* Radio options */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.option-label {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.option-label:hover {
  border-color: var(--green);
  background: rgba(16,185,129,0.06);
}

.option-label input[type="radio"] { display: none; }

.option-label.selected {
  border-color: var(--green);
  background: rgba(16,185,129,0.12);
}

.radio-custom {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  margin-top: 1px;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.option-label.selected .radio-custom {
  border-color: var(--green);
  background: var(--green);
}

.option-label.selected .radio-custom::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #fff;
  border-radius: 50%;
}

.option-letter {
  font-weight: 700;
  color: var(--green-light);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.option-text {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
}

/* Progress bar */
.progress-wrap {
  margin-bottom: 2rem;
}

.progress-track {
  height: 4px;
  background: var(--bg3);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--green-dark), var(--green-light), var(--orange));
  border-radius: 999px;
  transition: width 0.5s ease;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

/* Submit button */
.btn-submit {
  width: 100%;
  padding: 1rem;
  border-radius: 12px;
  border: none;
  background: linear-gradient(135deg, var(--green-dark), var(--green-light));
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.btn-submit:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(16,185,129,0.35);
}

.btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Toast / Alert */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 999;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: toastIn 0.4s ease;
  max-width: 380px;
}

.toast.success {
  background: rgba(16,185,129,0.15);
  border: 1px solid var(--green);
  color: var(--green-light);
}

.toast.error {
  background: rgba(239,68,68,0.15);
  border: 1px solid #ef4444;
  color: #f87171;
}

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

/* Success screen */
.success-screen {
  text-align: center;
  padding: 4rem 2rem;
}

.success-icon {
  font-size: 5rem;
  margin-bottom: 1rem;
  display: block;
}

.success-screen h2 {
  font-size: 2rem;
  font-weight: 800;
  color: var(--green-light);
  margin-bottom: 0.75rem;
}

.success-screen p {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* =========================================
   DASHBOARD STYLES
   ========================================= */
.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  padding: 0 1.5rem 4rem;
  max-width: 1280px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.stat-cards {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: var(--transition);
}

.stat-card:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }

.stat-icon {
  font-size: 1.8rem;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-card.green .stat-value { color: var(--green-light); }
.stat-card.orange .stat-value { color: var(--orange-light); }
.stat-card.blue .stat-value   { color: #60a5fa; }
.stat-card.purple .stat-value { color: #a78bfa; }

/* Chart cards */
.chart-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.chart-card.full { grid-column: 1 / -1; }

.chart-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-title .emoji { font-size: 1.1rem; }

.chart-wrap {
  position: relative;
  height: 260px;
}

.chart-wrap.tall { height: 320px; }

/* Tabla recientes */
.recent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.recent-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.recent-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.recent-table tr:last-child td { border-bottom: none; }
.recent-table tr:hover td { background: rgba(255,255,255,0.03); }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(16,185,129,0.15);
  color: var(--green-light);
  border: 1px solid rgba(16,185,129,0.25);
}

/* Dashboard header row */
.dash-header {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0 0 0.5rem;
}

.btn-export {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 10px;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--green-light);
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

.btn-export:hover {
  background: rgba(16,185,129,0.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16,185,129,0.2);
}

.refresh-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: 'Poppins', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.refresh-btn:hover { color: var(--text); border-color: var(--green); }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--green-light);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* No data state */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}

.empty-state .empty-icon { font-size: 3rem; display: block; margin-bottom: 0.75rem; }
.empty-state p { font-size: 0.9rem; }

/* Footer */
.footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .navbar { padding: 0.75rem 1rem; }
  .nav-links .nav-btn span { display: none; }
  .options-grid { grid-template-columns: 1fr; }
  .dashboard-layout { grid-template-columns: 1fr; }
  .chart-card.full { grid-column: 1; }
  .dash-header { flex-direction: column; align-items: flex-start; }
  .input-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .hero { padding: 3rem 1rem 2rem; }
  .card { padding: 1.25rem; }
}
