@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --background:        hsl(150, 20%, 97%);
  --foreground:        hsl(160, 30%, 10%);
  --card:              hsl(0, 0%, 100%);
  --card-foreground:   hsl(160, 30%, 10%);
  --primary:           hsl(152, 58%, 38%);
  --primary-fg:        hsl(0, 0%, 100%);
  --primary-light:     hsl(152, 58%, 38%, 0.1);
  --secondary:         hsl(150, 15%, 92%);
  --muted:             hsl(150, 10%, 94%);
  --muted-fg:          hsl(160, 10%, 45%);
  --accent:            hsl(38, 92%, 55%);
  --destructive:       hsl(0, 72%, 51%);
  --border:            hsl(150, 15%, 88%);
  --input-border:      hsl(150, 15%, 88%);
  --radius:            0.75rem;
  --shadow-sm:         0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:         0 4px 12px rgba(0,0,0,.08);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
}

h1,h2,h3,h4,h5 { font-family: 'Space Grotesk', sans-serif; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* ── HEADER ─────────────────────────────────────────────────────────────────── */
header.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
  background: #64748b;
}
.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem; font-weight: 700;
  background: #f8fafc; color: #001d5c;
  padding: .15rem .5rem; border-radius: .25rem;
  letter-spacing: -.01em;
}
.logo span { color: var(--primary); }
.header-admin-link {
  font-size: .875rem; color: #1e293b;
  border: 2px solid #cbd5e1; border-radius: var(--radius);
  padding: .3rem .75rem;
  font-family: serif;
  transition: background .2s;
}
.header-admin-link:hover { background: #f1f5f9; text-decoration: none; }

/* ── BADGE PILL ─────────────────────────────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: .4rem;
  background: rgba(var(--primary-rgb, 34,143,80), .1);
  color: var(--primary);
  border-radius: 9999px;
  padding: .4rem 1rem;
  font-size: .875rem; font-weight: 500;
  margin-bottom: 1.5rem;
}

/* ── HERO ───────────────────────────────────────────────────────────────────── */
.hero { padding: 0; }
.banner-wrap {
  padding: 1.5rem 1rem 0;
}
.banner-wrap button, .banner-wrap a {
  display: block; width: 100%;
  border-radius: 1rem; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s;
  border: none; background: none; cursor: pointer; padding: 0;
}
.banner-wrap button:hover, .banner-wrap a:hover { box-shadow: var(--shadow-md); }
.banner-wrap img { width: 100%; height: auto; display: block; }

.hero-content {
  padding: 3rem 1rem 2rem;
  text-align: center;
}
.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 700; letter-spacing: -.02em;
  margin-bottom: 1rem;
}
.hero-title span { color: var(--primary); }
.hero-desc {
  font-size: 1.1rem; color: var(--muted-fg);
  max-width: 600px; margin: 0 auto 2rem;
}

/* ── HOW IT WORKS ───────────────────────────────────────────────────────────── */
.how-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 1rem; padding: 1.5rem;
  max-width: 500px; margin: 0 auto 3rem;
  box-shadow: var(--shadow-sm); text-align: left;
}
.how-box h3 { font-size: 1.05rem; margin-bottom: 1rem; }
.how-steps { list-style: none; display: flex; flex-direction: column; gap: .75rem; }
.how-steps li { display: flex; align-items: flex-start; gap: .75rem; font-size: .9rem; color: var(--muted-fg); }
.step-num {
  flex-shrink: 0; width: 1.5rem; height: 1.5rem;
  border-radius: 50%; background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .7rem; font-weight: 700;
}

/* ── BENEFITS GRID ──────────────────────────────────────────────────────────── */
.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem; max-width: 900px; margin: 0 auto;
}
.benefit-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: .875rem; padding: 1.25rem;
  transition: box-shadow .2s;
}
.benefit-card:hover { box-shadow: var(--shadow-md); }
.benefit-icon {
  width: 2.5rem; height: 2.5rem;
  background: rgba(34,143,80,.1); border-radius: .5rem;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: .75rem; font-size: 1.1rem;
}
.benefit-card h3 { font-size: .95rem; margin-bottom: .4rem; }
.benefit-card p { font-size: .85rem; color: var(--muted-fg); }

/* ── SECTION TITLE ──────────────────────────────────────────────────────────── */
.section-title { text-align: center; margin-bottom: 2rem; }
.section-title h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: .4rem; }
.section-title p { color: var(--muted-fg); }

/* ── CARDS / PANELS ─────────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 1rem; padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }
.card h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 1rem; }

/* ── FORM ───────────────────────────────────────────────────────────────────── */
.form-section { padding: 4rem 0; }
.form-wrap { max-width: 680px; margin: 0 auto; }

.type-selector {
  display: flex; flex-direction: column; gap: 1rem;
}
@media (min-width: 480px) { .type-selector { flex-direction: row; } }

.type-option {
  flex: 1; border: 1.5px solid var(--border); border-radius: .875rem;
  padding: 1rem; cursor: pointer; transition: border-color .2s, background .2s;
  display: flex; align-items: center; gap: .75rem;
}
.type-option:hover { border-color: var(--primary); }
.type-option.selected { border-color: var(--primary); background: rgba(34,143,80,.05); }
.type-option input[type=radio] { accent-color: var(--primary); width: 1rem; height: 1rem; }
.type-option .opt-title { font-weight: 600; font-size: .95rem; }
.type-option .opt-desc { font-size: .78rem; color: var(--muted-fg); }

label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .35rem; }
.req { color: var(--destructive); }

input[type=text], input[type=email], input[type=tel], input[type=password],
input[type=date], select, textarea {
  width: 100%; padding: .55rem .75rem;
  border: 1px solid var(--input-border); border-radius: .5rem;
  background: var(--card); color: var(--foreground);
  font-family: inherit; font-size: .9rem;
  outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(34,143,80,.12);
}
.field-error { font-size: .78rem; color: var(--destructive); margin-top: .25rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 520px) { .grid-2 { grid-template-columns: 1fr; } }

.file-input-wrap { position: relative; }
input[type=file] {
  padding: .4rem .6rem; font-size: .85rem; cursor: pointer;
}
input[type=file]::file-selector-button {
  background: rgba(34,143,80,.1); color: var(--primary);
  border: none; border-radius: .375rem;
  padding: .3rem .75rem; font-size: .8rem; font-weight: 500;
  cursor: pointer; margin-right: .5rem;
  transition: background .2s;
}
input[type=file]::file-selector-button:hover { background: rgba(34,143,80,.2); }
.file-ok { font-size: .75rem; color: var(--primary); margin-top: .25rem; }

.indent-block {
  padding-left: 1rem;
  border-left: 2px solid rgba(34,143,80,.2);
}

.terms-row {
  display: flex; align-items: flex-start; gap: .75rem;
}
.terms-row input[type=checkbox] {
  width: 1rem; height: 1rem; flex-shrink: 0; margin-top: .15rem;
  accent-color: var(--primary);
}
.terms-row label { margin: 0; font-size: .875rem; cursor: pointer; }

/* ── BUTTONS ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1.25rem; border-radius: .5rem;
  font-family: inherit; font-size: .9rem; font-weight: 500;
  cursor: pointer; border: none; transition: opacity .2s, background .2s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { opacity: .9; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--foreground); }
.btn-outline:hover { background: var(--muted); }
.btn-destructive { background: var(--destructive); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted-fg); }
.btn-ghost:hover { background: var(--muted); }
.btn-sm { padding: .4rem .85rem; font-size: .82rem; }
.btn-lg { padding: .85rem 1.5rem; font-size: 1rem; width: 100%; }

/* ── SUCCESS STATE ──────────────────────────────────────────────────────────── */
.success-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 1rem; padding: 3rem 2rem; text-align: center;
  max-width: 480px; margin: 0 auto;
}
.success-icon { font-size: 3rem; margin-bottom: 1rem; }
.success-card h2 { font-size: 1.5rem; margin-bottom: .5rem; }
.success-card p { color: var(--muted-fg); }

/* ── TOAST ──────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  display: flex; flex-direction: column; gap: .5rem; z-index: 9999;
}
.toast {
  min-width: 220px; max-width: 360px;
  padding: .75rem 1rem; border-radius: .625rem;
  font-size: .875rem; font-weight: 500;
  box-shadow: var(--shadow-md);
  animation: slideIn .25s ease;
}
.toast-success { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.toast-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── FOOTER ─────────────────────────────────────────────────────────────────── */
footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1rem; text-align: center;
  font-size: .85rem; color: var(--muted-fg);
}
footer.site-footer a { color: var(--primary); }

/* ── ADMIN LOGIN ────────────────────────────────────────────────────────────── */
.admin-login-page {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  padding: 1rem;
}
.login-box { width: 100%; max-width: 360px; }
.login-icon {
  width: 3.5rem; height: 3.5rem;
  background: rgba(34,143,80,.1); border-radius: .875rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; margin: 0 auto 1rem;
}
.login-header { text-align: center; margin-bottom: 1.5rem; }
.login-header h1 { font-size: 1.5rem; margin-bottom: .25rem; }
.login-header p { font-size: .875rem; color: var(--muted-fg); }
.login-form { background: var(--card); border: 1px solid var(--border); border-radius: 1rem; padding: 1.5rem; }
.login-form .field { margin-bottom: 1rem; }
.login-error {
  background: #fee2e2; border: 1px solid #fecaca;
  color: #991b1b; border-radius: .5rem;
  padding: .6rem .9rem; font-size: .85rem; margin-bottom: 1rem;
}

/* ── ADMIN DASHBOARD ────────────────────────────────────────────────────────── */
.admin-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.admin-header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem;
}
.admin-logo { font-size: 1.05rem; font-weight: 700; }
.admin-logo span { color: var(--primary); }

.admin-body { padding: 1.5rem 1rem; }

.filters-bar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.filters-bar input, .filters-bar select {
  flex: 1; min-width: 140px;
}
.search-wrap { position: relative; flex: 2; min-width: 200px; }
.search-wrap input { padding-left: 2.2rem; }
.search-icon {
  position: absolute; left: .65rem; top: 50%; transform: translateY(-50%);
  color: var(--muted-fg); pointer-events: none; font-size: .9rem;
}

.count-label { font-size: .85rem; color: var(--muted-fg); margin-bottom: .75rem; }

/* Table */
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: 1rem; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead { background: var(--muted); }
th { padding: .7rem 1rem; text-align: left; font-weight: 600; font-size: .8rem; color: var(--muted-fg); white-space: nowrap; }
td { padding: .7rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
tr.clickable { cursor: pointer; transition: background .15s; }
tr.clickable:hover { background: var(--muted); }

/* Badges */
.badge {
  display: inline-block; padding: .2rem .6rem;
  border-radius: .375rem; font-size: .75rem; font-weight: 500;
  border: 1px solid transparent;
}
.badge-pendiente  { background: #fef9c3; color: #713f12; border-color: #fde68a; }
.badge-aprobado   { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.badge-rechazado  { background: #fee2e2; color: #991b1b; border-color: #fecaca; }
.badge-inactivo   { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* Detail panel */
.detail-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 1rem; padding: 1.5rem; margin-bottom: 1.25rem;
}
.detail-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 1rem; gap: 1rem; flex-wrap: wrap;
}
.detail-name { font-size: 1.2rem; font-weight: 700; }
.detail-meta { font-size: .82rem; color: var(--muted-fg); }
.detail-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.detail-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem; font-size: .875rem;
}
.detail-item span.lbl { color: var(--muted-fg); font-size: .8rem; display: block; }
.doc-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.doc-link {
  font-size: .8rem; color: var(--primary); cursor: pointer;
  display: flex; align-items: center; gap: .3rem;
  background: none; border: none; font-family: inherit;
}
.doc-link:hover { text-decoration: underline; }
.status-btns { display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap; }

/* Edit grid */
.edit-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .75rem;
}
.edit-grid .full { grid-column: 1 / -1; }

/* Admins modal */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 100;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border-radius: 1rem;
  padding: 1.5rem; width: 100%; max-width: 500px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.modal h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.modal-close {
  float: right; background: none; border: none;
  font-size: 1.2rem; cursor: pointer; color: var(--muted-fg);
}

/* Spinner */
.spinner {
  display: inline-block; width: 1rem; height: 1rem;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabs */
.tabs { display: flex; gap: 0; margin-bottom: 1.25rem; border-bottom: 2px solid var(--border); }
.tab {
  padding: .5rem 1rem; font-size: .875rem; font-weight: 500;
  cursor: pointer; border: none; background: none;
  color: var(--muted-fg); border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: color .15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Confirm dialog */
.confirm-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 200;
  align-items: center; justify-content: center; padding: 1rem;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--card); border-radius: 1rem;
  padding: 1.5rem; width: 100%; max-width: 380px;
  box-shadow: var(--shadow-md);
}
.confirm-box h3 { margin-bottom: .5rem; }
.confirm-box p { font-size: .875rem; color: var(--muted-fg); margin-bottom: 1.25rem; }
.confirm-btns { display: flex; gap: .5rem; justify-content: flex-end; }

@media (max-width: 640px) {
  .hide-sm { display: none !important; }
}
@media (max-width: 900px) {
  .hide-md { display: none !important; }
}
