/* =========================
   Variables y reset básico
   ========================= */

:root {
  --bg-body: #f3f4f6;
  --bg-card: #ffffff;
  --bg-soft: #f9fafb;
  --bg-header: #0f172a;
  --bg-footer: #020617;

  --border-subtle: #e5e7eb;
  --border-strong: #cbd5f5;

  --text-main: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --text-invert: #ffffff;

  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --accent-strong: #1d4ed8;
  --danger: #dc2626;
  --success: #16a34a;

  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;

  --shadow-soft: 0 10px 25px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 12px 30px rgba(15, 23, 42, 0.10);

  --font-base: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --transition-fast: 0.18s ease-out;
}

/* Reset muy ligero */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-base);
  background: radial-gradient(circle at top, #e5edff 0, #f3f4f6 45%, #e5e7eb 100%);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

button {
  font-family: inherit;
}

/* =========================
   Layout general
   ========================= */

.site-header {
  background: radial-gradient(circle at top left, #1d4ed8, #0f172a 55%);
  color: var(--text-invert);
  padding: 1.1rem 0 1.25rem;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.4);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-title {
  margin: 0 0 0.25rem;
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.site-subtitle {
  margin: 0;
  font-size: 0.9rem;
  color: rgba(249, 250, 251, 0.8);
}

.site-main {
  padding: 1.5rem 0 2.5rem;
}

.site-footer {
  background: var(--bg-footer);
  color: rgba(249, 250, 251, 0.8);
  padding: 1rem 0 1.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
  font-size: 0.8rem;
}

.footer-note {
  margin: 0.35rem 0 0;
  color: rgba(148, 163, 184, 0.95);
}

.container {
  width: 100%;
  max-width: 1024px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* Grid principal */

.layout-grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 900px) {
  .layout-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.9fr);
    align-items: flex-start;
  }
}

/* =========================
   Tarjetas principales
   ========================= */

.create-plan,
.plans-section {
  background: rgba(255, 255, 255, 0.96);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  padding: 1.25rem 1.1rem 1.35rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(10px);
}

.create-plan h2,
.plans-section h2 {
  margin-top: 0;
  margin-bottom: 0.9rem;
  font-size: 1.1rem;
}

/* =========================
   Formularios
   ========================= */

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin-bottom: 0.7rem;
}

.form-row {
  display: grid;
  gap: 0.8rem;
}

@media (min-width: 640px) {
  .form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

input,
select,
textarea {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 0.65rem;
  font-size: 0.9rem;
  background: var(--bg-soft);
  color: var(--text-main);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
}

textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-soft);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-soft);
  background: #ffffff;
}

input:invalid:focus,
select:invalid:focus,
textarea:invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.15);
}

.field-hint,
.save-hint {
  margin: 0;
  font-size: 0.75rem;
  color: var(--text-soft);
}

/* =========================
   Botones
   ========================= */

.btn-primary,
.btn-secondary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0.45rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: var(--text-invert);
  box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
  background: #ffffff;
  border-color: var(--border-subtle);
  color: var(--text-muted);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: #f9fafb;
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}

.btn-ghost:hover {
  color: var(--accent);
  border-color: rgba(148, 163, 184, 0.4);
  background: rgba(15, 23, 42, 0.02);
}

/* Acciones formulario crear plan */

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  margin-top: 0.4rem;
}

/* Mensajes de estado del formulario */

.form-error,
.form-success {
  margin-top: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
}

.form-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #b91c1c;
}

.form-success {
  background: rgba(22, 163, 74, 0.08);
  border: 1px solid rgba(22, 163, 74, 0.6);
  color: #166534;
}

/* =========================
   Espacio publicidad
   ========================= */

.ad-slot {
  margin-top: 1rem;
  padding: 0.75rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(245, 158, 11, 0.9);
  background: #fffbeb;
  font-size: 0.8rem;
  color: #92400e;
}

.ad-title {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}

/* =========================
   Header sección planes
   ========================= */

.plans-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.results-count {
  margin: 0.1rem 0 0;
  font-size: 0.8rem;
  color: var(--text-soft);
}

/* =========================
   Filtros
   ========================= */

.filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.6rem 0.8rem;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.9rem;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  border: 1px solid rgba(209, 213, 219, 0.9);
}

.filters-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 0.1rem;
}

@media (min-width: 640px) {
  .filters {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: flex-end;
  }

  .filters-actions {
    justify-content: flex-end;
  }
}

/* =========================
   Lista de planes
   ========================= */

.plan-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.9rem;
}

@media (min-width: 640px) {
  .plan-list {
    grid-template-columns: minmax(0, 1fr);
  }
}

.plan {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.85rem 0.95rem;
  border: 1px solid rgba(209, 213, 219, 0.9);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.plan:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.17);
  border-color: rgba(129, 140, 248, 0.9);
  background: linear-gradient(135deg, #ffffff, #eef2ff);
}

.plan-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 0.3rem;
}

.plan-header-main {
  flex: 1;
  min-width: 0;
}

.plan-title {
  margin: 0 0 0.1rem;
  font-size: 1rem;
}

.plan-location {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.plan-people {
  margin: 0;
}

.plan-description {
  margin: 0.4rem 0 0.45rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.plan-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  margin: 0.1rem 0 0.5rem;
}

.plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.5rem;
}

/* Badges */

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.7rem;
  border: 1px solid rgba(148, 163, 184, 0.9);
  background: #f9fafb;
  color: var(--text-soft);
}

.badge-province {
  border-color: rgba(59, 130, 246, 0.7);
  background: rgba(59, 130, 246, 0.08);
  color: #1d4ed8;
}

.badge-city {
  border-style: dashed;
}

.badge-people {
  border-color: rgba(16, 185, 129, 0.8);
  background: rgba(16, 185, 129, 0.08);
  color: #047857;
}

/* =========================
   Estados vacíos y API
   ========================= */

.empty-state {
  margin-top: 0.5rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(148, 163, 184, 0.9);
  background: #f9fafb;
  font-size: 0.85rem;
  color: var(--text-soft);
}

.api-status {
  margin-top: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-soft);
}

/* =========================
   Responsivo extra
   ========================= */

@media (max-width: 599px) {
  .site-header {
    padding-inline: 0;
  }

  .create-plan,
  .plans-section {
    padding-inline: 0.9rem;
  }

  .plan {
    padding-inline: 0.8rem;
  }

  .filters {
    padding-inline: 0.7rem;
  }
}
