/* ====================================================================
   SACRO — Estilos principales
   Diseño mobile-first, paleta cálida y elegante
   ==================================================================== */

/* ── Variables ────────────────────────────────────────────────────── */
:root {
  --primary:        #8B6F47;
  --primary-dark:   #6E5538;
  --primary-light:  #C4A882;
  --primary-bg:     #F0E8DD;

  --nav-bg:         #2C2420;
  --nav-active:     #C4A882;
  --nav-text:       #D4C4B0;

  --bg:             #FAF8F5;
  --surface:        #FFFFFF;
  --surface-2:      #F5F1EC;

  --text:           #1A1410;
  --text-secondary: #5C4F40;
  --text-muted:     #9C8A78;

  --border:         #E5D9CC;
  --border-strong:  #C9B89E;
  --bg-hover:       #F5EEE6;

  --success:        #2D7A4F;
  --success-bg:     #D1FAE5;
  --danger:         #C0392B;
  --danger-bg:      #FEE2E2;
  --warning:        #B45309;
  --warning-bg:     #FEF3C7;
  --info:           #1D6FA4;
  --info-bg:        #DBEAFE;

  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  --shadow:         0 1px 4px rgba(44,36,32,.10);
  --shadow-md:      0 4px 12px rgba(44,36,32,.15);
  --shadow-lg:      0 8px 24px rgba(44,36,32,.18);

  --header-h:       56px;
  --sidebar-w:      240px;
  --bottom-nav-h:   62px;

  --transition:     .15s ease;
}

/* ── Reset ───────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: inherit; }

/* ── Layout ─────────────────────────────────────────────────────── */

/* Mobile: header fijo arriba + bottom-nav fijo abajo + content en medio */
.app-layout {
  display: block;
  padding-top: var(--header-h);
  padding-bottom: var(--bottom-nav-h);
  min-height: 100vh;
}

/* Desktop: sidebar fijo izquierda, contenido desplazado */
@media (min-width: 768px) {
  .app-layout {
    padding-top: 0;
    padding-bottom: 0;
    padding-left: var(--sidebar-w);
  }
}

/* ── App Header (móvil) ─────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 100;
  background: var(--nav-bg);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.app-header__brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--nav-active);
  flex-shrink: 0;
}
.app-header__appname { color: #fff; }
.app-header__parish {
  flex: 1;
  font-size: 14px;
  color: var(--nav-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header__avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--nav-bg);
  font-weight: 700;
  font-size: 14px;
  border: none;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}
@media (min-width: 768px) { .app-header { display: none; } }

/* ── User Dropdown ──────────────────────────────────────────────── */
.user-dropdown {
  position: fixed;
  top: calc(var(--header-h) + 8px);
  right: 12px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 220px;
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 4px;
}
.user-dropdown.open { display: flex; }
.user-dropdown__name { font-weight: 600; font-size: 15px; }
.user-dropdown__role { font-size: 13px; margin-top: 2px; align-self: flex-start; }
.user-dropdown__divider { height: 1px; background: var(--border); margin: 6px 0; }
.user-dropdown__parish-btn {
  text-align: left;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: var(--transition);
}
.user-dropdown__parish-btn:hover { background: var(--bg-hover); }
.user-dropdown__parish-btn.active { border-color: var(--primary); background: var(--primary-bg); color: var(--primary-dark); font-weight: 600; }
.user-dropdown__item {
  padding: 9px 10px;
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--text);
  transition: var(--transition);
  display: block;
}
.user-dropdown__item:hover { background: var(--bg-hover); }
.user-dropdown__item--danger { color: var(--danger); }
.user-dropdown__item--danger:hover { background: var(--danger-bg); }

/* ── App Sidebar (desktop) ──────────────────────────────────────── */
.app-sidebar {
  display: none;
}
@media (min-width: 768px) {
  .app-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--nav-bg);
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
  }
}
.app-sidebar__brand {
  padding: 20px 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: var(--nav-active);
  letter-spacing: .03em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar__nav {
  flex: 1;
  padding: 12px 0;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: var(--nav-text);
  font-size: 15px;
  font-weight: 500;
  transition: var(--transition);
  text-decoration: none;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item--active {
  background: rgba(196,168,130,.15);
  color: var(--nav-active);
  border-left-color: var(--nav-active);
  font-weight: 600;
}
.nav-item__icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-divider { height: 1px; background: rgba(255,255,255,.08); margin: 8px 16px; }
.app-sidebar__footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.app-sidebar__user-name { font-size: 14px; font-weight: 600; color: #fff; }
.app-sidebar__user-role { font-size: 12px; color: var(--nav-text); margin-bottom: 10px; }
.app-sidebar__logout {
  font-size: 13px;
  color: var(--nav-text);
  display: inline-block;
  transition: var(--transition);
}
.app-sidebar__logout:hover { color: var(--danger); }

/* ── Bottom Nav (móvil) ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bottom-nav-h);
  background: var(--nav-bg);
  display: flex;
  align-items: stretch;
  z-index: 100;
  border-top: 1px solid rgba(255,255,255,.10);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
@media (min-width: 768px) { .bottom-nav { display: none; } }
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--nav-text);
  font-size: 10px;
  text-decoration: none;
  transition: var(--transition);
  padding-bottom: 4px;
}
.bottom-nav__item--active { color: var(--nav-active); }
.bottom-nav__item:hover { color: #fff; }
.bottom-nav__icon { font-size: 22px; line-height: 1; }
.bottom-nav__label { font-size: 11px; font-weight: 500; }

/* ── App Content ────────────────────────────────────────────────── */
.app-content {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px 16px 24px;
}
@media (min-width: 768px) { .app-content { padding: 28px 28px 32px; } }

/* ── Page Header ────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
@media (min-width: 768px) { .page-title { font-size: 28px; } }
.page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── Cards ───────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}
.card__title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: 14px;
}

/* ── Stats Grid ─────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
@media (min-width: 600px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card__number {
  font-size: 34px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card__label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── List Items ──────────────────────────────────────────────────── */
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
  transition: background var(--transition);
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-hover); }
.list-item__avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--primary-bg);
  color: var(--primary-dark);
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.list-item__body {
  flex: 1;
  min-width: 0;
}
.list-item__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item__subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-item__arrow { color: var(--border-strong); font-size: 22px; flex-shrink: 0; }
.list-item__date-col {
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}
.list-item__day { font-size: 22px; font-weight: 800; color: var(--primary); line-height: 1; }
.list-item__month { font-size: 13px; text-transform: uppercase; color: var(--text-muted); }

/* ── Event Items (dashboard) ────────────────────────────────────── */
.event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  margin-bottom: 6px;
  text-decoration: none;
  color: var(--text);
  border-left: 3px solid var(--primary);
  background: var(--surface);
  transition: background var(--transition);
}
.event-item:hover { background: var(--bg-hover); }
.event-item__date {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  min-width: 32px;
  text-align: center;
}
.event-item__info { flex: 1; min-width: 0; }
.event-item__title { font-size: 15px; font-weight: 600; }
.event-item__meta  { font-size: 13px; color: var(--text-muted); }

/* ── FAB ─────────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 16px);
  right: 20px;
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  text-decoration: none;
  z-index: 90;
  transition: background var(--transition), box-shadow var(--transition);
  line-height: 1;
  font-weight: 300;
}
.fab:hover { background: var(--primary-dark); box-shadow: var(--shadow-lg); color: #fff; }
@media (min-width: 768px) { .fab { bottom: 24px; right: 28px; } }

/* ── Search Bar ──────────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.search-bar .form-control { flex: 1; }

/* ── Filter Row & Chips ─────────────────────────────────────────── */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 15px;
  border-radius: 20px;
  border: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-secondary);
  background: var(--surface);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.filter-chip:hover { border-color: var(--primary); color: var(--primary); }
.filter-chip.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1.2;
}
.btn-primary    { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-secondary  { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger     { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { opacity: .88; color: #fff; }
.btn-success    { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { opacity: .88; color: #fff; }
.btn-ghost      { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn-sm { padding: 7px 16px; font-size: 13px; }

/* ── Badges ──────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
  white-space: nowrap;
  background: var(--primary-bg);
  color: var(--primary-dark);
}
.badge-danger  { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-info    { background: var(--info-bg); color: var(--info); }
.badge-neutral { background: var(--surface-2); color: var(--text-muted); }

/* ── Forms ───────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }
.form-label {
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.form-hint { font-size: 13px; color: var(--text-muted); margin-top: -2px; }
.req { color: var(--danger); }
.form-control {
  display: block;
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139,111,71,.15);
}
.form-control::placeholder { color: var(--text-muted); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 16px;
  border-radius: var(--radius);
  font-size: 15px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-danger  { background: var(--danger-bg); color: var(--danger); border-color: #fca5a5; }
.alert-success { background: var(--success-bg); color: var(--success); border-color: #6ee7b7; }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: #fcd34d; }
.alert-icon { font-size: 16px; flex-shrink: 0; }

/* ── Pagination ──────────────────────────────────────────────────── */
.pagination {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 16px;
}
.page-link {
  min-width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0 8px;
  transition: all var(--transition);
}
.page-link:hover { border-color: var(--primary); color: var(--primary); }
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }

/* ── Empty State ─────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state__icon { font-size: 40px; margin-bottom: 10px; }
.empty-state__text { font-size: 18px; font-weight: 600; margin-bottom: 6px; }
.empty-state__hint { font-size: 15px; }

/* ── Login page ──────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nav-bg);
  padding: 20px;
}
.login-box {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  font-size: 48px;
  text-align: center;
  margin-bottom: 8px;
  color: var(--primary);
}
.login-title {
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}
.login-subtitle {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* ── Thumbnail / Upload preview ──────────────────────────────────── */
.img-preview {
  width: 80px; height: 80px;
  border-radius: var(--radius);
  object-fit: cover;
  border: 1px solid var(--border);
}

/* ── Print ───────────────────────────────────────────────────────── */
@media print {
  .app-header, .app-sidebar, .bottom-nav, .fab,
  .search-bar, .filter-row, .pagination,
  .btn-danger, button[type=submit] { display: none !important; }
  .app-content { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  body { background: white; color: black; }
  a { color: black; }
}
