/* ================================================================
   Sistema de Administración de Condominio — Estilos principales
   ================================================================ */

/* ── Variables ──────────────────────────────────────────────────── */
:root {
  --bg:         #ffffff;
  --sidebar:    #f8f9fa;
  --primary:    #2c3e50;
  --primary-dk: #1a252f;
  --accent:     #27ae60;
  --danger:     #e74c3c;
  --warning:    #f39c12;
  --info:       #3498db;
  --text:       #2d3748;
  --text-light: #718096;
  --border:     #e2e8f0;
  --shadow:     0 1px 8px rgba(0,0,0,.08);
  --radius:     10px;
  --sidebar-w:  250px;
  --topbar-h:   60px;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body {
  font-family: 'Nunito', 'Inter', sans-serif;
  background: #f0f2f5;
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Layout ─────────────────────────────────────────────────────── */
.wrapper {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: transform .25s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-brand h1 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
}
.sidebar-brand small {
  font-size: .7rem;
  color: rgba(255,255,255,.55);
  display: block;
}

.sidebar-nav { padding: .75rem 0; flex: 1; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.25rem;
  color: rgba(255,255,255,.75);
  font-size: .88rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.sidebar-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: var(--accent);
}
.sidebar-nav a i { width: 18px; text-align: center; font-size: .9rem; }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255,255,255,.1);
  font-size: .78rem;
  color: rgba(255,255,255,.4);
}
.sidebar-footer a {
  color: rgba(255,255,255,.55);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.sidebar-footer a:hover { color: var(--danger); }

/* ── Main content area ──────────────────────────────────────────── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Top bar ────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 90;
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  color: var(--text-light);
}
.topbar-user .avatar {
  width: 32px; height: 32px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
}

/* Hamburger */
.btn-hamburger {
  display: none;
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text);
  cursor: pointer;
  padding: .25rem;
}

/* ── Content area ───────────────────────────────────────────────── */
.content {
  padding: 1.5rem;
  flex: 1;
}
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}
.page-header h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.page-header h2 i {
  color: var(--primary);
  margin-right: .4rem;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
}
.card-header h3 i {
  color: var(--primary);
  margin-right: .35rem;
}
.card-body { padding: 1.25rem; }
.card-footer {
  padding: .75rem 1.25rem;
  background: #fafbfc;
  border-top: 1px solid var(--border);
  font-size: .82rem;
  color: var(--text-light);
}

/* ── Stat cards (dashboard) ─────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
}
.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-icon.green  { background: #d4edda; color: var(--accent); }
.stat-icon.red    { background: #fde8e8; color: var(--danger); }
.stat-icon.blue   { background: #d6eaf8; color: var(--info); }
.stat-icon.orange { background: #fef3cd; color: var(--warning); }

.stat-info h4 {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .03em;
  margin-bottom: .2rem;
}
.stat-info .stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.stat-info .stat-value.text-success { color: var(--accent); }
.stat-info .stat-value.text-danger  { color: var(--danger); }

/* ── Grid layouts ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }

/* ── Tables ─────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  background: #f8fafc;
  padding: .7rem 1rem;
  text-align: left;
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f9fafb; }
.table tbody tr:nth-child(even) { background: #fcfcfc; }
.table tbody tr:nth-child(even):hover { background: #f4f6f8; }

.table .actions { display: flex; gap: .4rem; flex-wrap: nowrap; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .25rem .65rem;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
  white-space: nowrap;
}
.badge-success { background: #d4edda; color: #155724; }
.badge-danger  { background: #fde8e8; color: #7b1f1f; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-info    { background: #d6eaf8; color: #0c5460; }
.badge-secondary { background: #e2e8f0; color: #4a5568; }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s, opacity .15s, transform .1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dk); color: #fff; }
.btn-success   { background: var(--accent); color: #fff; }
.btn-success:hover { background: #219a52; color: #fff; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c0392b; color: #fff; }
.btn-warning   { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d68910; color: #fff; }
.btn-info      { background: var(--info); color: #fff; }
.btn-info:hover { background: #2176ae; color: #fff; }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e0; }
.btn-outline   { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: .3rem .65rem; font-size: .78rem; border-radius: 6px; }
.btn-lg { padding: .7rem 1.5rem; font-size: .95rem; }
.btn-icon { padding: .35rem; width: 30px; height: 30px; justify-content: center; border-radius: 6px; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  margin-bottom: .35rem;
  font-size: .83rem;
  font-weight: 600;
  color: var(--text);
}
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: .55rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .875rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(44,62,80,.12);
}
.form-control:disabled { background: #f0f2f5; color: var(--text-light); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }

.form-row { display: grid; gap: 1rem; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-hint { font-size: .76rem; color: var(--text-light); margin-top: .25rem; }
.form-error { font-size: .76rem; color: var(--danger); margin-top: .25rem; }

/* ── Alerts ─────────────────────────────────────────────────────── */
.alert {
  padding: .85rem 1.1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: .875rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.alert i { margin-top: .1rem; flex-shrink: 0; }
.alert-success { background: #d4edda; color: #155724; border-left: 4px solid var(--accent); }
.alert-danger  { background: #fde8e8; color: #7b1f1f; border-left: 4px solid var(--danger); }
.alert-warning { background: #fff3cd; color: #856404; border-left: 4px solid var(--warning); }
.alert-info    { background: #d6eaf8; color: #0c5460; border-left: 4px solid var(--info); }

/* ── Modal ──────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .2s ease;
}
.modal-lg { max-width: 720px; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-header {
  padding: 1.1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-light);
  padding: .25rem;
  line-height: 1;
  border-radius: 6px;
}
.modal-close:hover { background: #f0f2f5; color: var(--danger); }
.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .6rem;
}

/* ── Filtros / Search bar ───────────────────────────────────────── */
.filters {
  display: flex;
  gap: .75rem;
  align-items: flex-end;
  flex-wrap: wrap;
  background: #fff;
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.filters .form-group { margin-bottom: 0; flex: 1; min-width: 140px; }

/* ── Dept cards ─────────────────────────────────────────────────── */
.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.dept-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  border-left: 4px solid var(--border);
  transition: box-shadow .15s;
}
.dept-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.dept-card.corriente { border-left-color: var(--accent); }
.dept-card.adeudo    { border-left-color: var(--danger); }
.dept-card.parcial   { border-left-color: var(--warning); }

.dept-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dept-card-name { font-weight: 700; font-size: .95rem; }
.dept-card-meta { font-size: .8rem; color: var(--text-light); }
.dept-card-actions { display: flex; gap: .4rem; margin-top: .4rem; }

/* ── Prestaciones table ─────────────────────────────────────────── */
.prestaciones-table td:last-child { font-weight: 700; color: var(--accent); }

/* ── Monto positive/negative ─────────────────────────────────────── */
.monto-pos { color: var(--accent); font-weight: 700; }
.monto-neg { color: var(--danger); font-weight: 700; }
.monto-neutral { color: var(--text); font-weight: 700; }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-light);
}
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; display: block; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── Print styles ───────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .btn, .no-print { display: none !important; }
  .main-content { margin-left: 0; }
  .content { padding: 0; }
  .card { box-shadow: none; }
  body { background: #fff; }
}

/* ── Login page ─────────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, #34495e 100%);
  padding: 1rem;
}
.login-card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 400px;
  padding: 2.5rem 2rem;
}
.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}
.login-logo .icon {
  width: 64px; height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 1rem;
}
.login-logo h2 { font-size: 1.2rem; color: var(--text); font-weight: 800; }
.login-logo p  { font-size: .82rem; color: var(--text-light); }
.login-footer { text-align: center; margin-top: 1.5rem; font-size: .75rem; color: var(--text-light); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .btn-hamburger {
    display: block;
  }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 1rem; }
  .page-header { gap: .5rem; }
  .table th, .table td { padding: .5rem .75rem; }
  .modal { max-width: 100%; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .login-card { padding: 1.75rem 1.25rem; }
}

/* Overlay when sidebar open on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

/* Misc utilities */
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--text-light); font-size: .82rem; }
.fw-bold { font-weight: 700; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.flex-wrap { flex-wrap: wrap; }
.w-100 { width: 100%; }
.hidden { display: none; }
