/* ============================================
   ORDENANZAS — CONCEJO DELIBERANTE
   styles.css
   ============================================ */

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

:root {
  --navy:    #1a2e4a;
  --navy-lt: #243d61;
  --gold:    #c8a84b;
  --gold-lt: #e8c97a;
  --bg:      #f5f6f8;
  --surface: #ffffff;
  --border:  #e0e3e8;
  --text:    #1e2636;
  --muted:   #6b7280;
  --vigente:    #16a34a;
  --novigente:  #dc2626;
  --consolidada:#2563eb;
  --radius:  10px;
  --shadow:  0 2px 12px rgba(26,46,74,.08);
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- HEADER ---- */
.site-header {
  background: var(--navy);
  border-bottom: 3px solid var(--gold);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1300px; margin: 0 auto;
  padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { flex-shrink: 0; }
.brand-title { display: block; color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand-sub   { display: block; color: var(--gold-lt); font-size: .72rem; font-weight: 400; letter-spacing: .02em; }
.header-nav  { display: flex; gap: 8px; }
.nav-link {
  color: rgba(255,255,255,.7); text-decoration: none;
  padding: 6px 14px; border-radius: 6px; font-size: .85rem; font-weight: 500;
  transition: background .2s, color .2s;
}
.nav-link:hover, .nav-link.active {
  background: rgba(200,168,75,.15); color: var(--gold-lt);
}

/* ---- HERO ---- */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-lt) 100%);
  padding: 48px 24px 52px;
}
.hero-inner { max-width: 760px; margin: 0 auto; text-align: center; }
.hero-title { color: #fff; font-size: 2rem; font-weight: 700; margin-bottom: 10px; }
.hero-sub   { color: rgba(255,255,255,.65); font-size: .95rem; margin-bottom: 28px; }

.search-bar {
  display: flex; align-items: center;
  background: #fff; border-radius: 50px;
  padding: 6px 6px 6px 18px;
  box-shadow: 0 4px 24px rgba(0,0,0,.25);
}
.search-icon { color: var(--muted); flex-shrink: 0; }
.search-input {
  flex: 1; border: none; outline: none;
  font-size: .95rem; padding: 8px 12px;
  font-family: inherit; background: transparent;
}
.search-btn {
  background: var(--gold); color: var(--navy);
  border: none; border-radius: 40px;
  padding: 10px 24px; font-weight: 700; font-size: .9rem;
  cursor: pointer; transition: background .2s;
  white-space: nowrap;
}
.search-btn:hover { background: var(--gold-lt); }

/* ---- MAIN LAYOUT ---- */
.main-layout {
  flex: 1;
  max-width: 1300px; margin: 0 auto; width: 100%;
  padding: 28px 24px;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
}

/* ---- SIDEBAR ---- */
.sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: sticky; top: 80px;
}
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--gold);
}
.sidebar-title { font-weight: 700; font-size: 1rem; color: var(--navy); }
.clear-btn {
  font-size: .78rem; font-weight: 600; color: var(--gold);
  background: none; border: none; cursor: pointer; padding: 2px 6px;
  border-radius: 4px; transition: background .2s;
}
.clear-btn:hover { background: rgba(200,168,75,.1); }

.filter-group { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.filter-group:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.filter-label {
  font-size: .72rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 10px;
}
.filter-option {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 4px; cursor: pointer;
  font-size: .85rem; border-radius: 6px;
  transition: background .15s;
}
.filter-option:hover { background: rgba(26,46,74,.04); }
.filter-option input[type="radio"],
.filter-option input[type="checkbox"] { accent-color: var(--navy); }
.filter-option em {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 4px;
  background: var(--navy); color: var(--gold-lt);
  font-style: normal; font-weight: 700; font-size: .7rem; flex-shrink: 0;
}
.cat-list { display: flex; flex-direction: column; gap: 2px; }

.date-label { font-size: .78rem; color: var(--muted); display: block; margin: 8px 0 4px; }
.date-input {
  width: 100%; padding: 6px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: .85rem; font-family: inherit;
  color: var(--text); outline: none; transition: border .2s;
}
.date-input:focus { border-color: var(--navy); }

/* ---- BADGES ---- */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: 20px;
  font-size: .75rem; font-weight: 600;
}
.badge-vigente   { background: #dcfce7; color: var(--vigente); }
.badge-novigente { background: #fee2e2; color: var(--novigente); }
.badge-consolidada { background: #dbeafe; color: var(--consolidada); }

/* ---- TOOLBAR ---- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.result-count { font-size: .85rem; color: var(--muted); font-weight: 500; }
.toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.view-btn {
  width: 34px; height: 34px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--muted); transition: all .2s;
}
.view-btn:hover, .view-btn.active {
  background: var(--navy); color: #fff; border-color: var(--navy);
}
.sort-select {
  padding: 6px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: .83rem; font-family: inherit;
  color: var(--text); background: var(--surface); cursor: pointer; outline: none;
}
.export-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--navy); color: #fff;
  border: none; border-radius: 6px; padding: 7px 16px;
  font-size: .83rem; font-weight: 600; cursor: pointer; transition: background .2s;
}
.export-btn:hover { background: var(--navy-lt); }

/* ---- GRID ---- */
.ordenanzas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.ordenanzas-list { display: flex; flex-direction: column; gap: 10px; }

/* ---- CARD ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(26,46,74,.13);
  border-color: var(--gold);
}
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-numero {
  font-size: .75rem; font-weight: 700; color: var(--navy);
  background: rgba(26,46,74,.07); padding: 3px 8px; border-radius: 4px;
  white-space: nowrap;
}
.card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.card-titulo { font-weight: 600; font-size: .9rem; color: var(--text); line-height: 1.4; }
.card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card-fecha { font-size: .78rem; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.card-cat {
  font-size: .75rem; font-weight: 600;
  background: rgba(200,168,75,.12); color: var(--navy);
  padding: 2px 8px; border-radius: 4px;
}
.card-desc { font-size: .82rem; color: var(--muted); line-height: 1.5; }
.card-actions { display: flex; gap: 8px; margin-top: 4px; }
.btn-ver {
  flex: 1; text-align: center;
  padding: 7px; border-radius: 6px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--navy); background: none; color: var(--navy);
  transition: background .2s, color .2s;
}
.btn-ver:hover { background: var(--navy); color: #fff; }
.btn-pdf {
  padding: 7px 12px; border-radius: 6px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  border: none; background: var(--gold); color: var(--navy);
  display: flex; align-items: center; gap: 4px;
  transition: background .2s;
}
.btn-pdf:hover { background: var(--gold-lt); }

/* Card — vista lista */
.card-list {
  flex-direction: row; align-items: center; gap: 16px; padding: 14px 18px;
}
.card-list .card-titulo { flex: 1; }
.card-list .card-meta { flex-shrink: 0; }

/* ---- EMPTY STATE ---- */
.empty-state {
  text-align: center; padding: 64px 24px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
}
.empty-state p { color: var(--muted); font-size: .95rem; }
.clear-btn-lg {
  padding: 10px 24px; border-radius: 8px;
  background: var(--navy); color: #fff;
  border: none; font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: background .2s;
}
.clear-btn-lg:hover { background: var(--navy-lt); }
.hidden { display: none !important; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15,25,42,.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface);
  border-radius: 14px;
  max-width: 640px; width: 100%;
  padding: 32px;
  position: relative;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.modal-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 1.2rem;
  cursor: pointer; color: var(--muted); line-height: 1;
  padding: 4px 8px; border-radius: 4px;
  transition: background .2s;
}
.modal-close:hover { background: var(--bg); }
.modal-numero { font-size: .78rem; font-weight: 700; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 8px; }
.modal-titulo { font-size: 1.3rem; font-weight: 700; color: var(--navy); margin-bottom: 14px; line-height: 1.3; }
.modal-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.modal-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 20px;
}
.modal-field label { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: block; margin-bottom: 2px; }
.modal-field p { font-size: .9rem; color: var(--text); }
.modal-desc { font-size: .9rem; color: var(--text); line-height: 1.6; margin-bottom: 24px; }
.modal-actions { display: flex; gap: 10px; }
.btn-modal-pdf {
  flex: 1; padding: 11px; border-radius: 8px;
  background: var(--navy); color: #fff;
  border: none; font-weight: 700; font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .2s;
}
.btn-modal-pdf:hover { background: var(--navy-lt); }

/* ---- FOOTER ---- */
.site-footer {
  background: var(--navy); color: rgba(255,255,255,.5);
  text-align: center; padding: 18px 24px; font-size: .8rem;
  border-top: 2px solid var(--gold);
  margin-top: auto;
}
.site-footer strong { color: var(--gold-lt); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
  .hero-title { font-size: 1.5rem; }
}
@media (max-width: 540px) {
  .header-nav { display: none; }
  .ordenanzas-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
}
