/* --- VARIABLES GLOBALES Y TEMAS --- */
:root {
  --bg: #EEF2FF;
  --card: #FFFFFF;
  --primary: #0057FF;
  --primary-dark: #003FCC;
  --accent: #7C3AED;
  --success: #10B981;
  --danger: #E53E3E;
  --danger-bg: #FFF5F5;
  --danger-border: #FEB2B2;
  --text: #1A1A2E;
  --text-muted: #4A5568;
  --shadow-sm: 0 2px 10px rgba(0, 87, 255, 0.08);
  --shadow-md: 0 8px 28px rgba(0, 87, 255, 0.14);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Poppins', sans-serif;
  --touch-target: 48px;
}

[data-theme="dark"] {
  --bg: #09090F;
  --card: #13131F;
  --text: #EEEEFF;
  --text-muted: #9CA3AF;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.5);
  --danger-bg: #1A0808;
  --danger-border: #742A2A;
}

/* --- RESET Y BASE --- */
html { scroll-behavior: smooth; }

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

section {
  margin: 40px 0;
}

h2 {
  text-align: center;
  margin-bottom: 24px;
  color: var(--primary);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.3;
}

[data-theme="dark"] h2 {
  color: #60A5FA;
}

/* --- HEADER --- */
header {
  background: linear-gradient(135deg, #0057FF 0%, #7C3AED 100%);
  color: #fff;
  padding: 52px 20px 44px;
  text-align: center;
  border-radius: 0 0 28px 28px;
  position: relative;
  overflow: hidden;
}

header::before {
  content: '';
  position: absolute;
  top: -40%;
  left: -10%;
  width: 55%;
  height: 180%;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}

header::after {
  content: '';
  position: absolute;
  bottom: -50%;
  right: -10%;
  width: 45%;
  height: 160%;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 50%;
  pointer-events: none;
}

.header-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 50px;
  margin-bottom: 14px;
}

header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.2;
  position: relative;
}

header p {
  font-size: 0.95rem;
  opacity: 0.88;
  position: relative;
}

/* --- TOGGLE TEMA --- */
#theme-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.1rem;
  transition: background 0.25s, transform 0.2s;
  -webkit-tap-highlight-color: transparent;
  z-index: 10;
}

#theme-toggle:hover  { background: rgba(255, 255, 255, 0.28); }
#theme-toggle:active { transform: scale(0.92); }

#theme-toggle .fa-moon { display: none; }
[data-theme="dark"] #theme-toggle .fa-sun  { display: none; }
[data-theme="dark"] #theme-toggle .fa-moon { display: block; }

/* --- GRID DE CARDS --- */
.grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

/* --- CARD --- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:active { transform: scale(0.98); }

.card i {
  font-size: 1.9rem;
  color: var(--primary);
}

[data-theme="dark"] .card i { color: #60A5FA; }

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* --- BOTONES --- */
.btn-primary,
.btn-secondary,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-target);
  padding: 12px 28px;
  border-radius: 50px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.9rem;
  text-decoration: none;
  color: #fff;
  border: none;
  cursor: pointer;
  margin-top: 16px;
  transition: transform 0.2s, filter 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary   { background: var(--primary); }
.btn-secondary { background: var(--accent); }
.btn-danger    {
  background: var(--danger);
  font-size: 1rem;
  padding: 14px 32px;
  min-height: 54px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(229, 62, 62, 0.45);
}

.btn-primary:hover,
.btn-secondary:hover  { filter: brightness(1.12); transform: translateY(-2px); }
.btn-danger:hover     { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(229, 62, 62, 0.5); }

.btn-primary:active,
.btn-secondary:active,
.btn-danger:active    { transform: scale(0.96); filter: brightness(0.95); }

/* --- SECCIONES DE CONTENIDO --- */
.content-section {
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 20px;
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.content-section__icon {
  font-size: 2.4rem;
  color: var(--primary);
  margin-bottom: 12px;
  line-height: 1;
}

[data-theme="dark"] .content-section__icon { color: #60A5FA; }

.content-section h2 {
  margin-bottom: 10px;
}

.content-section p {
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto;
}

.content-section ul {
  list-style: none;
  padding: 0;
  margin: 14px auto;
  display: inline-block;
  text-align: left;
}

.content-section ul li {
  padding-left: 1.8em;
  position: relative;
  margin-bottom: 8px;
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.content-section ul li::before {
  content: '✅';
  position: absolute;
  left: 0;
}

/* --- SECCIÓN ACCENT (Matific) --- */
.content-section--accent {
  background: linear-gradient(135deg, #F5F3FF 0%, #EDE9FE 100%);
  border-top: 4px solid var(--accent);
}

[data-theme="dark"] .content-section--accent {
  background: linear-gradient(135deg, #1E1B4B 0%, #1A1040 100%);
  border-top-color: #A78BFA;
}

[data-theme="dark"] .content-section--accent .content-section__icon { color: #A78BFA; }
[data-theme="dark"] .content-section--accent h2 { color: #A78BFA; }

/* --- SECCIÓN DANGER (Reporte de fallas) --- */
.content-section--danger {
  background: var(--danger-bg);
  border: 2px solid var(--danger-border);
}

.danger-icon {
  font-size: 3rem;
  color: var(--danger);
  margin-bottom: 14px;
  animation: pulse-icon 2.2s ease-in-out infinite;
  line-height: 1;
}

@keyframes pulse-icon {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.1); }
}

.content-section--danger h2 {
  color: var(--danger);
  font-size: 1.35rem;
}

.danger-steps {
  list-style: none;
  padding: 0;
  margin: 16px auto;
  display: inline-block;
  text-align: left;
  max-width: 380px;
  width: 100%;
}

.danger-steps li {
  padding: 10px 12px 10px 44px;
  position: relative;
  margin-bottom: 10px;
  background: rgba(229, 62, 62, 0.07);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--text);
}

.danger-steps li::before {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--danger);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.danger-steps li:nth-child(1)::before { content: '1'; }
.danger-steps li:nth-child(2)::before { content: '2'; }

/* --- FOOTER --- */
footer {
  text-align: center;
  padding: 24px 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 40px;
  border-top: 1px solid rgba(0, 0, 0, 0.07);
}

[data-theme="dark"] footer {
  border-top-color: rgba(255, 255, 255, 0.07);
}

/* --- BOTÓN VOLVER ARRIBA --- */
.top {
  position: fixed;
  bottom: 20px;
  right: 16px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 1.3rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 87, 255, 0.45);
  display: none;
  place-items: center;
  transition: opacity 0.3s, transform 0.3s;
  opacity: 0;
  transform: translateY(20px);
  -webkit-tap-highlight-color: transparent;
  z-index: 100;
}

.top.show {
  display: grid;
  opacity: 1;
  transform: translateY(0);
}

/* --- TABLET: 2 columnas --- */
@media (min-width: 520px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  header h1 { font-size: 2.2rem; }

  .btn-danger { width: auto; }
}

/* --- DESKTOP --- */
@media (min-width: 768px) {
  .container { padding: 24px; }

  header {
    padding: 72px 40px 60px;
    border-radius: 0 0 32px 32px;
  }

  header h1 { font-size: 2.6rem; }

  section { margin: 56px 0; }

  h2 { font-size: 1.75rem; }

  .grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
  }

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

  .content-section { padding: 36px 40px; }

  #theme-toggle {
    top: 20px;
    right: 20px;
  }
}
