/* ============================================================
   CondFlow — Estilos del Portal Residente
   Diseño amigable tipo app móvil, distinto del panel staff:
   tarjetas grandes y redondeadas, bottom-nav, colores cálidos
   derivados de la misma paleta de marca (navy + coral).
   ============================================================ */

:root {
  --res-navy:        #2b2d6e;
  --res-coral:        #e8674f;
  --res-coral-soft:   #f4a896;
  --res-bg:           #f7f6fb;
  --res-surface:      #ffffff;
  --res-border:       #ebe9f5;
  --res-text:         #1d1f33;
  --res-text-muted:   #767b91;
  --res-accent:       var(--res-coral);
  --res-success:      #1f9d6c;
  --res-success-bg:   #e6f7ef;
  --res-warning-bg:   #fff3e6;
  --res-danger:       #d8453a;
  --res-radius-lg:    20px;
  --res-radius-md:    14px;
  --res-topbar-h:     68px;
  --res-bottomnav-h:  72px;
}

* { box-sizing: border-box; }

.res-body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--res-bg);
  color: var(--res-text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

.res-body a { text-decoration: none; color: inherit; }

/* ---- Topbar ---- */
.res-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--res-topbar-h);
  background: var(--res-navy);
  display: flex;
  align-items: center;
}
.res-topbar-inner {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.res-brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.res-brand-logo { height: 32px; width: 32px; border-radius: 8px; object-fit: cover; }
.res-brand-text { display: flex; flex-direction: column; line-height: 1.15; font-size: 0.85rem; }
.res-brand-text strong { font-size: 0.95rem; }
.res-brand-text span { color: rgba(255,255,255,0.7); font-size: 0.75rem; }

.res-balance-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.85rem;
}
.res-balance-due  { background: var(--res-coral-soft); color: #7a2316; }
.res-balance-clear{ background: var(--res-success-bg); color: var(--res-success); }

/* ---- Main / container ---- */
.res-main {
  padding: 18px 0 calc(var(--res-bottomnav-h) + 18px);
  min-height: 100vh;
}
.res-container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px;
}

.res-page-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin: 4px 0 16px;
  color: var(--res-text);
}

/* ---- Bottom nav ---- */
.res-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--res-bottomnav-h);
  background: var(--res-surface);
  border-top: 1px solid var(--res-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
  box-shadow: 0 -4px 16px rgba(43,45,110,0.06);
}
.res-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  color: var(--res-text-muted);
  font-weight: 600;
  padding: 8px 10px;
  border-radius: 12px;
  transition: color 0.15s, background 0.15s;
}
.res-nav-item i { font-size: 1.25rem; }
.res-nav-item.active { color: var(--res-coral); background: var(--res-coral-soft); }

/* ---- Balance card (dashboard) ---- */
.res-balance-card {
  border-radius: var(--res-radius-lg);
  padding: 24px 20px;
  text-align: center;
  margin-bottom: 20px;
  color: #fff;
}
.res-balance-card-due   { background: linear-gradient(135deg, var(--res-coral), #d2412e); }
.res-balance-card-clear { background: linear-gradient(135deg, #22a878, #1a7d5a); }
.res-balance-label { font-size: 0.85rem; opacity: 0.9; font-weight: 600; }
.res-balance-amount { font-size: 2.2rem; font-weight: 800; margin: 4px 0 2px; }

/* ---- Sections ---- */
.res-section { margin-bottom: 22px; }
.res-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--res-text-muted);
  margin-bottom: 10px;
}

/* ---- List card (used for receipts, payments, events rows) ---- */
.res-list-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--res-surface);
  border-radius: var(--res-radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(43,45,110,0.06);
  transition: transform 0.1s;
}
.res-list-card:active { transform: scale(0.98); }

.res-list-icon {
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}
.res-icon-primary { background: #e8eaff; color: var(--res-navy); }
.res-icon-warning { background: var(--res-warning-bg); color: #b3690a; }
.res-icon-info    { background: #e3f1fd; color: #1f6fa8; }
.res-icon-success { background: var(--res-success-bg); color: var(--res-success); }

.res-list-body { flex: 1; min-width: 0; }
.res-list-title { font-weight: 700; font-size: 0.92rem; }
.res-list-sub { font-size: 0.78rem; color: var(--res-text-muted); margin-top: 2px; }
.res-list-desc { font-size: 0.82rem; color: var(--res-text-muted); margin-top: 6px; }
.res-list-amount { font-weight: 800; font-size: 0.95rem; white-space: nowrap; }

.res-link-center {
  display: block;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--res-coral);
  padding: 8px 0;
}

.res-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--res-text-muted);
  margin-bottom: 14px;
}

/* ---- Detail card (receipt/payment detail, profile) ---- */
.res-detail-card {
  background: var(--res-surface);
  border-radius: var(--res-radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(43,45,110,0.06);
}
.res-detail-sub { color: var(--res-text-muted); font-size: 0.85rem; margin: -8px 0 12px; }

.res-amount-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--res-border);
  border-bottom: 1px solid var(--res-border);
}
.res-amount-row > div { text-align: center; flex: 1; }
.res-amount-label { display: block; font-size: 0.72rem; color: var(--res-text-muted); margin-bottom: 2px; }

/* ---- Empty state ---- */
.res-empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--res-text-muted);
}
.res-empty-state i { font-size: 2.6rem; display: block; margin-bottom: 12px; color: var(--res-coral-soft); }

/* ---- Forms ---- */
.res-field { margin-bottom: 14px; }
.res-label { display: block; font-weight: 700; font-size: 0.85rem; margin-bottom: 5px; }
.res-input {
  width: 100%;
  border: 1.5px solid var(--res-border);
  border-radius: var(--res-radius-md);
  padding: 11px 14px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--res-surface);
  color: var(--res-text);
  transition: border-color 0.15s;
}
.res-input:focus { outline: none; border-color: var(--res-coral); }
.res-hint { display: block; font-size: 0.72rem; color: var(--res-text-muted); margin-top: 4px; }

/* ---- Buttons ---- */
.btn-res-primary, .btn-res-outline, .btn-res-outline-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--res-radius-md);
  padding: 12px 20px;
  font-weight: 700;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  text-align: center;
}
.btn-res-primary { background: var(--res-coral); color: #fff; }
.btn-res-primary:hover { background: #d2412e; color: #fff; }
.btn-res-outline { background: var(--res-surface); color: var(--res-text); border: 1.5px solid var(--res-border); }
.btn-res-outline-danger { background: #fdeceb; color: var(--res-danger); }
.btn-res-sm { padding: 8px 14px; font-size: 0.82rem; }
.w-100 { width: 100%; }

/* ---- Alerts ---- */
.res-alert {
  border-radius: var(--res-radius-md);
  padding: 12px 14px;
  font-size: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}
.res-alert-danger  { background: #fdeceb; color: var(--res-danger); }
.res-alert-success { background: var(--res-success-bg); color: var(--res-success); }
.res-alert-warning { background: var(--res-warning-bg); color: #8a5a0a; }
.res-alert-info    { background: #e3f1fd; color: #1f6fa8; }

/* ---- Auth screens (login, forgot password) ---- */
.res-auth-main {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, var(--res-navy), #1d1f4d);
}
.res-auth-card {
  background: var(--res-surface);
  border-radius: var(--res-radius-lg);
  padding: 32px 26px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.res-auth-logo { text-align: center; margin-bottom: 14px; }
.res-auth-logo img { height: 56px; width: 56px; border-radius: 14px; object-fit: cover; }
.res-auth-title { text-align: center; font-size: 1.4rem; font-weight: 800; margin: 0 0 6px; }
.res-auth-subtitle { text-align: center; color: var(--res-text-muted); font-size: 0.85rem; margin-bottom: 20px; }

/* ---- Tables inside detail cards (re-use Bootstrap table but tone it down) ---- */
.res-detail-card table th { color: var(--res-text-muted); font-weight: 600; font-size: 0.82rem; }
.res-detail-card table td { font-size: 0.88rem; }

@media (min-width: 560px) {
  .res-list-card:hover { box-shadow: 0 4px 14px rgba(43,45,110,0.1); }
}

/* ================================================================
   RESPONSIVE TABLET (576px – 767px)
   Contenedor más ancho, 2 columnas en formularios
   ================================================================ */
@media (min-width: 576px) {
  .res-container    { max-width: 680px; }
  .res-topbar-inner { max-width: 680px; }
  .res-bottom-nav   { max-width: 680px; }

  .res-page-title   { font-size: 1.6rem; }
  .res-auth-card    { max-width: 420px; padding: 40px 32px; }

  /* Tarjetas de lista en grid 2 columnas si hay varias */
  .res-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .res-grid-2 .res-list-card { margin-bottom: 0; }
}

/* ================================================================
   RESPONSIVE LAPTOP / PC (768px+)
   Barra superior completa, nav lateral, layout 2 columnas
   ================================================================ */
@media (min-width: 768px) {
  :root {
    --res-topbar-h: 64px;
    --res-bottomnav-h: 0px;
    --res-sidenav-w: 220px;
  }

  /* Contenedor más ancho */
  .res-container    { max-width: 900px; padding: 0 28px; }
  .res-topbar-inner { max-width: 900px; padding: 0 28px; }

  /* Ocultar bottom nav, mostrar topbar nav */
  .res-bottom-nav { display: none; }

  /* Main: sin padding-bottom de bottom-nav */
  .res-main { padding: 24px 0 40px; }

  /* Topbar con links de navegación */
  .res-topbar-inner { gap: 0; }
  .res-topbar-nav {
    display: flex !important;
    align-items: center;
    gap: 2px;
    margin-left: auto;
    margin-right: 16px;
  }
  .res-topbar-nav a {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: .82rem;
    font-weight: 600;
    color: rgba(255,255,255,.75);
    text-decoration: none;
    transition: background .15s, color .15s;
    white-space: nowrap;
  }
  .res-topbar-nav a:hover  { background: rgba(255,255,255,.1); color: #fff; }
  .res-topbar-nav a.active { background: rgba(255,255,255,.15); color: #fff; }
  .res-topbar-nav a i { font-size: 1rem; }

  /* Balance pill más visible */
  .res-balance-pill { font-size: .88rem; padding: 7px 16px; }

  /* Tarjetas más grandes */
  .res-detail-card  { padding: 28px 32px; border-radius: 18px; }
  .res-list-card    { padding: 16px 20px; }
  .res-page-title   { font-size: 1.8rem; }

  /* Formularios de 2 columnas en pantallas grandes */
  .res-form-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .res-form-2col .res-field-full { grid-column: 1 / -1; }

  /* Botones más anchos pero no 100% */
  .btn-res-primary.w-100 { max-width: 320px; }

  /* Auth card más amplia */
  .res-auth-card { max-width: 460px; padding: 48px 40px; }
  .res-auth-title { font-size: 1.6rem; }

  /* Secciones del dashboard en grid */
  .res-dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .res-dashboard-grid > .res-section:first-child { grid-column: 1 / -1; }
}

/* ================================================================
   RESPONSIVE WIDESCREEN (1024px+)
   Layout más espacioso
   ================================================================ */
@media (min-width: 1024px) {
  .res-container    { max-width: 1000px; }
  .res-topbar-inner { max-width: 1000px; }

  .res-detail-card  { padding: 32px 40px; }
  .res-main         { padding: 32px 0 40px; }
}

/* ================================================================
   MEJORAS TÁCTILES iOS / Android (toda la app)
   ================================================================ */
/* Evitar zoom al enfocar un input en iOS (Safari) */
.res-input, select.res-input {
  font-size: max(16px, 0.95rem);
}
@media (min-width: 768px) {
  .res-input { font-size: .95rem; }
}

/* Área de toque mínima recomendada (44×44px) */
.res-nav-item { min-width: 64px; min-height: 44px; }
.btn-res-primary, .btn-res-outline, .btn-res-outline-danger { min-height: 44px; }
.btn-res-sm { min-height: 38px; }

/* ================================================================
   TOPBAR NAV — Oculto en móvil (se muestra solo desde 768px)
   ================================================================ */
.res-topbar-nav { display: none; }
