/* assets/css/style.css */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a3a6b;
  --primary-mid: #1a56db;
  --primary-light: #e8f0fe;
  --green: #0a7a3e;
  --green-light: #e6f4ed;
  --amber: #b45309;
  --amber-light: #fef3c7;
  --red: #b91c1c;
  --red-light: #fee2e2;
  --purple: #5b21b6;
  --purple-light: #ede9fe;
  --teal: #0f766e;
  --teal-light: #ccfbf1;
  --gray: #6b7280;
  --border: #e5e7eb;
  --bg: #f4f6fb;
  --white: #ffffff;
  --sidebar-w: 230px;
  --topbar-h: 54px;
  --text: #111827;
  --text-muted: #6b7280;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.08);
}

body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

/* ── LAYOUT ── */
.app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar { width: var(--sidebar-w); background: var(--white); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--primary); color: #fff; }
.brand-icon { font-size: 24px; line-height: 1; }
.brand-title { font-weight: 700; font-size: 13px; line-height: 1.2; }
.brand-sub { font-size: 10px; opacity: .65; margin-top: 1px; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--primary-light); color: var(--primary-mid); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }
.user-name { font-size: 12px; font-weight: 600; }
.user-role { font-size: 10px; color: var(--gray); }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 12px 16px 4px; font-size: 10px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: .05em; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: #374151; text-decoration: none; font-size: 13px; border-left: 3px solid transparent; transition: all .15s; }
.nav-item:hover { background: #f9fafb; color: var(--primary-mid); }
.nav-item.active { background: var(--primary-light); color: var(--primary-mid); border-left-color: var(--primary-mid); font-weight: 600; }
.nav-item i { font-size: 17px; flex-shrink: 0; }
.sidebar-footer { padding: 8px 0; border-top: 1px solid var(--border); }

/* ── MAIN ── */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar { height: var(--topbar-h); background: var(--white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 20px; flex-shrink: 0; }
.topbar-title { font-size: 16px; font-weight: 700; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user { font-size: 13px; color: var(--gray); }
.topbar-search-icon { display: none; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; background: #f3f4f6; color: var(--text); text-decoration: none; font-size: 18px; }
.search-form { display: flex; align-items: center; gap: 7px; background: #f9fafb; border: 1px solid var(--border); border-radius: 7px; padding: 6px 12px; }
.search-form i { color: var(--gray); font-size: 15px; }
.search-form input { border: none; background: transparent; outline: none; font-size: 13px; width: 200px; color: var(--text); }
.search-field { display: flex; align-items: center; gap: 7px; background: #f9fafb; border: 1px solid var(--border); border-radius: 7px; padding: 6px 12px; width: 100%; }
.search-field i { color: var(--gray); font-size: 15px; }
.search-field input { border: none; background: transparent; outline: none; font-size: 13px; width: 100%; color: var(--text); }
.page-content { flex: 1; overflow-y: auto; padding: 20px; }

/* ── CARDS ── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.card-title i { font-size: 16px; color: var(--primary-mid); }

/* ── GRID ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; }
@media(max-width:900px){ .grid-2,.grid-3,.grid-4{grid-template-columns:1fr;} }

/* ── STATS ── */
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px; }
.stat-num { font-size: 32px; font-weight: 700; color: var(--primary-mid); line-height: 1; }
.stat-label { font-size: 12px; color: var(--gray); margin-top: 4px; }
.stat-change { font-size: 11px; margin-top: 5px; }

/* ── FORMS ── */
.form-group { margin-bottom: 12px; }
.form-label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: #374151; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; color: var(--text); background: var(--white); outline: none; transition: border-color .15s;
}
.form-input:focus,.form-select:focus,.form-textarea:focus { border-color: var(--primary-mid); box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.form-check input { width: 16px; height: 16px; cursor: pointer; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius); font-size: 13px; font-weight: 500; cursor: pointer; border: none; text-decoration: none; transition: all .15s; white-space: nowrap; }
.btn i { font-size: 15px; }
.btn-primary   { background: var(--primary-mid); color: #fff; }       .btn-primary:hover   { background: #1648c0; }
.btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid var(--border); } .btn-secondary:hover { background: #e5e7eb; }
.btn-success   { background: var(--green-light); color: var(--green); } .btn-success:hover   { background: #d1fae5; }
.btn-danger    { background: var(--red-light); color: var(--red); }    .btn-danger:hover    { background: #fecaca; }
.btn-warning   { background: var(--amber-light); color: var(--amber); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-sm i { font-size: 14px; }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: #f9fafb; padding: 9px 14px; text-align: left; font-size: 11px; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); }
.table td { padding: 10px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr.clickable { cursor: pointer; } .table tr.clickable:hover td { background: #f0f5ff; }

/* ── CHIPS / BADGES ── */
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip-blue   { background: var(--primary-light); color: var(--primary-mid); }
.chip-green  { background: var(--green-light);   color: var(--green); }
.chip-amber  { background: var(--amber-light);   color: var(--amber); }
.chip-red    { background: var(--red-light);     color: var(--red); }
.chip-purple { background: var(--purple-light);  color: var(--purple); }
.chip-teal   { background: var(--teal-light);    color: var(--teal); }
.chip-gray   { background: #f3f4f6;              color: #374151; }

/* ── ALERTS ── */
.alert { padding: 10px 14px; border-radius: var(--radius); font-size: 13px; display: flex; align-items: flex-start; gap: 8px; margin-bottom: 12px; }
.alert i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-info    { background: var(--primary-light); color: #1e3a6e; border: 1px solid #bfdbfe; }
.alert-success { background: var(--green-light);   color: #065f46; border: 1px solid #6ee7b7; }
.alert-warning { background: var(--amber-light);   color: #92400e; border: 1px solid #fde68a; }
.alert-danger  { background: var(--red-light);     color: var(--red); border: 1px solid #fca5a5; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 1000; opacity: 0; visibility: hidden; transition: all .2s; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { background: var(--white); border-radius: var(--radius-lg); width: 580px; max-width: 96vw; max-height: 92vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.18); transform: translateY(10px); transition: transform .2s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal.modal-lg { width: 760px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.modal-title { font-weight: 700; font-size: 15px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* ── TABS ── */
.tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; gap: 0; }
.tab-btn { padding: 9px 18px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; background: none; color: var(--gray); border-bottom: 2px solid transparent; transition: all .15s; }
.tab-btn.active { color: var(--primary-mid); border-bottom-color: var(--primary-mid); }

/* ── TIMELINE ── */
.timeline { padding-left: 24px; position: relative; }
.timeline::before { content:''; position: absolute; left: 8px; top: 0; bottom: 0; width: 1px; background: var(--border); }
.tl-item { position: relative; padding: 0 0 16px 18px; }
.tl-dot { position: absolute; left: -16px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--primary-mid); border: 2px solid var(--white); box-shadow: 0 0 0 2px var(--primary-mid); }
.tl-date { font-size: 11px; color: var(--gray); margin-bottom: 3px; }
.tl-box { background: #f9fafb; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; font-size: 13px; }
.tl-box strong { display: block; font-size: 13px; margin-bottom: 3px; }

/* ── PERSON ROW ── */
.person-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f3f4f6; }
.person-row:last-child { border-bottom: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); color: var(--primary-mid); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0; }

/* ── DOC ITEM ── */
.doc-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #f9fafb; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 6px; }
.doc-item i { font-size: 20px; color: var(--primary-mid); }

/* ── MISC ── */
.page-header { margin-bottom: 16px; }
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header p { font-size: 13px; color: var(--gray); margin-top: 3px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--gray); }
.empty-state i { font-size: 44px; opacity: .25; display: block; margin-bottom: 12px; }
.section-sub { font-size: 12px; color: var(--gray); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.progress-bar { background: #e5e7eb; border-radius: 99px; height: 7px; overflow: hidden; flex: 1; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--primary-mid); }
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 20px; text-align: center; color: var(--gray); font-size: 13px; cursor: pointer; transition: border-color .15s; }
.upload-zone:hover { border-color: var(--primary-mid); background: var(--primary-light); }
.upload-zone i { font-size: 28px; display: block; margin-bottom: 6px; }
.text-right { text-align: right; }
.text-muted { color: var(--gray); }
.fw-600 { font-weight: 600; }
.mb-0 { margin-bottom: 0; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-1 { flex: 1; }
.w-100 { width: 100%; }
.inst-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px; }
.inst-icon { width: 40px; height: 40px; border-radius: var(--radius); background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--primary-mid); flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE / MOBILE  — Municipalidad San Pedro de Jujuy
   ══════════════════════════════════════════════════════════ */

/* Hamburger button — hidden on desktop */
.hamburger-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  color: var(--primary);
  font-size: 20px;
  flex-shrink: 0;
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}
.sidebar-overlay.visible { display: block; }

@media (max-width: 768px) {
  /* Layout shifts */
  .app-layout { display: block; height: auto; overflow: visible; }

  /* Sidebar becomes drawer */
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s ease;
    overflow-y: auto;
  }
  .sidebar.open { transform: translateX(0); }

  /* Main content fills viewport */
  .main-content { display: flex; flex-direction: column; min-height: 100vh; }

  /* Topbar */
  .topbar {
    position: sticky; top: 0; z-index: 100;
    padding: 0 12px;
    height: 52px;
  }
  .hamburger-btn { display: flex; }
  .search-form { display: none; }
  .topbar-search-icon { display: flex !important; }
  .topbar-user { font-size: 11px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

  /* Page content */
  .page-content { padding: 12px; }

  /* Grids go single column */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; }

  /* Tables get horizontal scroll */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; }

  /* Cards full width */
  .card { padding: 12px; }
  .stat-card { padding: 14px; }
  .stat-num { font-size: 24px; }

  /* Modals full screen on mobile */
  .modal { width: 95vw !important; max-width: 95vw !important; max-height: 92vh; }
  .modal.modal-lg { width: 95vw !important; }

  /* Tabs scrollable */
  .tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .tab-btn { white-space: nowrap; flex-shrink: 0; }

  /* Login */
  .login-box { width: 94vw !important; padding: 24px 18px !important; }

  /* Buttons on small screens */
  .btn { font-size: 12px; padding: 7px 12px; }

  /* Page headers */
  .page-header h1 { font-size: 17px; }

  /* Flex rows wrap */
  .d-flex { flex-wrap: wrap; }

  /* Timeline */
  .timeline { padding-left: 16px; }
}

/* Print styles */
@media print {
  .sidebar, .topbar, .hamburger-btn, .sidebar-overlay,
  .btn, form, .tabs, .page-header p { display: none !important; }
  .app-layout { display: block; }
  .main-content { display: block; }
  .page-content { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
  table { font-size: 11px; }
}

/* No-print elements (print buttons, etc.) */
@media print {
  .no-print { display: none !important; }
}
