/* ============================================
   ORDENANZAS — CONCEJO DELIBERANTE
   styles.css
   Paleta derivada del escudo oficial (logos/concejo-escudo.png):
   azul institucional + celeste + verde, con navy como base.
   ============================================ */

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

button {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  font-family: inherit;
}

:root {
  --navy:    #1a2e4a;
  --navy-lt: #243d61;
  --accent:    #1d7fb8;
  --accent-lt: #7cc4e8;
  --brand-green: #7ab648;
  --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);
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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 transparent;
  border-image: linear-gradient(90deg, var(--accent) 0%, var(--brand-green) 100%) 1;
  box-shadow: 0 2px 10px rgba(0,0,0,.12);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1300px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  min-height: 68px;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-icon { flex-shrink: 0; display: flex; align-items: center; }
.brand-icon img { height: 44px; width: auto; display: block; }
.brand-title { display: block; color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand-sub   { display: block; color: var(--accent-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(255,255,255,.12); color: var(--accent-lt);
}
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px; margin-left: 4px;
  background: var(--brand-green); color: #fff;
  border-radius: 999px; font-size: .68rem; font-weight: 700;
  vertical-align: middle;
}

/* ---- AVISOS ---- */
.avisos-banner {
  background: #fffbeb;
  border-bottom: 1px solid #fde68a;
}
.aviso-item {
  max-width: 1300px; margin: 0 auto;
  padding: 10px 24px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid #fde68a;
}
.aviso-item:last-child { border-bottom: none; }
.aviso-img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.aviso-body { flex: 1; min-width: 0; }
.aviso-body strong { display: block; font-size: .85rem; color: #92400e; }
.aviso-body p { font-size: .8rem; color: #78350f; margin-top: 2px; }
.aviso-close {
  background: none; border: none; cursor: pointer; color: #92400e;
  font-size: .9rem; padding: 4px 8px; flex-shrink: 0;
}
.aviso-close:hover { color: #451a03; }

/* ---- 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; }
.hero-avisos .hero-sub { margin-bottom: 0; }

/* ---- AVISOS: PESTAÑA COMPLETA ---- */
.avisos-page { max-width: 1000px; margin: 0 auto; padding: 32px 24px 60px; }
.avisos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
}
.aviso-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--brand-green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .2s ease, box-shadow .2s ease;
}
.aviso-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(26,46,74,.15); }
.aviso-card-img { width: 100%; height: 160px; object-fit: cover; display: block; }
.aviso-card-body { padding: 18px 20px; display: flex; flex-direction: column; gap: 8px; }
.aviso-card-icon { color: var(--brand-green); }
.aviso-card-title { font-size: 1rem; font-weight: 700; color: var(--navy); line-height: 1.35; }
.aviso-card-content { font-size: .85rem; color: var(--text); line-height: 1.55; }
.aviso-card-date {
  align-self: flex-start; margin-top: 4px;
  font-size: .72rem; font-weight: 600; color: var(--brand-green);
  background: rgba(122,182,72,.12); padding: 3px 10px; border-radius: 20px;
}

.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;
  border-radius: 8px; transition: background-color .3s ease;
}
.search-input.voice-filled { background-color: rgba(122,182,72,.15); }
.mic-btn {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex-shrink: 0; margin: 0 2px; padding: 0;
  border: none; outline: none; border-radius: 50%;
  background: rgba(29,127,184,.08); color: var(--accent);
  cursor: pointer; transition: background .2s ease, color .2s ease, transform .15s ease, box-shadow .2s ease;
}
.mic-btn svg { display: block; pointer-events: none; }
.mic-btn:hover { background: rgba(29,127,184,.16); transform: scale(1.06); }
.mic-btn:active { transform: scale(.92); }
.mic-btn.listening {
  background: var(--novigente); color: #fff;
  animation: mic-pulse 1.6s ease-out infinite;
}
@keyframes mic-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(220,38,38,.4); }
  70%  { box-shadow: 0 0 0 14px rgba(220,38,38,0); }
  100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}
.mic-status {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--accent-lt); font-size: .8rem; font-weight: 500;
  margin-top: 12px; text-align: center;
}
.mic-status::before {
  content: ''; width: 7px; height: 7px; border-radius: 50%;
  background: var(--novigente); flex-shrink: 0;
  animation: mic-dot 1s ease-in-out infinite;
}
@keyframes mic-dot {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50%      { opacity: 1; transform: scale(1.15); }
}
.search-btn {
  background: var(--accent); color: #fff;
  border: none; border-radius: 40px;
  padding: 10px 24px; font-weight: 700; font-size: .9rem;
  cursor: pointer; transition: background .2s, transform .1s;
  white-space: nowrap;
}
.search-btn:hover { background: var(--navy); }
.search-btn:active { transform: scale(.96); }

/* ---- 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: 0 4px 20px rgba(26,46,74,.10);
  position: sticky; top: 80px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: var(--accent-lt); }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--accent);
  position: sticky; top: -20px;
  background: var(--surface);
  z-index: 1;
  margin-top: -20px; padding-top: 20px;
}
.sidebar-title { font-weight: 700; font-size: 1rem; color: var(--navy); }
.sidebar-header-actions { display: flex; align-items: center; gap: 8px; }
.clear-btn {
  font-size: .78rem; font-weight: 600; color: var(--accent);
  background: none; border: none; cursor: pointer; padding: 2px 6px;
  border-radius: 4px; transition: background .2s;
}
.clear-btn:hover { background: rgba(29,127,184,.1); }
.filters-toggle {
  display: none;
  align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  cursor: pointer; transition: transform .2s, background .2s;
}
.filters-toggle:hover { background: var(--bg); }
.filters-toggle.expanded { transform: rotate(180deg); }

.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(--accent-lt);
  font-style: normal; font-weight: 700; font-size: .7rem; flex-shrink: 0;
}
.cat-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
  margin-right: -4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.cat-list::-webkit-scrollbar { width: 5px; }
.cat-list::-webkit-scrollbar-track { background: transparent; }
.cat-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
.cat-list::-webkit-scrollbar-thumb:hover { background: var(--accent-lt); }

.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(--accent); }

/* ---- 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, transform .1s;
}
.export-btn:hover { background: var(--navy-lt); }
.export-btn:active { transform: scale(.96); }

/* ---- LOADING ---- */
.loading-state {
  text-align: center; padding: 64px 24px; color: var(--muted); font-size: .95rem;
}
.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.skeleton-card {
  height: 168px; border-radius: var(--radius);
  background: linear-gradient(100deg, var(--surface) 30%, #eef0f3 50%, var(--surface) 70%);
  background-size: 200% 100%;
  border: 1px solid var(--border);
  animation: skeleton-shine 1.4s ease-in-out infinite;
}
@keyframes skeleton-shine {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- 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-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
}
.card.card-vigente { border-left-color: var(--vigente); }
.card.card-no-vigente { border-left-color: var(--novigente); }
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(26,46,74,.15);
}
.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(29,127,184,.1); 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, transform .1s;
}
.btn-ver:hover { background: var(--navy); color: #fff; }
.btn-ver:active { transform: scale(.97); }
.btn-pdf {
  padding: 7px 12px; border-radius: 6px;
  font-size: .8rem; font-weight: 600; cursor: pointer;
  border: none; background: var(--accent); color: #fff;
  display: flex; align-items: center; gap: 4px;
  transition: background .2s, transform .1s;
}
.btn-pdf:hover { background: var(--navy); }
.btn-pdf:active { transform: scale(.94); }

/* 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,.4);
  text-align: center; padding: 16px 24px; font-size: .74rem;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap;
}
.site-footer img { height: 16px; width: auto; opacity: .5; }
.site-footer a { color: rgba(255,255,255,.6); text-decoration: none; font-weight: 500; }
.site-footer a:hover { color: var(--accent-lt); }
.site-footer strong { font-weight: 500; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .main-layout { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .sidebar-header {
    position: static;
    margin: 0 0 16px; padding: 0 0 12px;
  }
  .hero-title { font-size: 1.5rem; }

  .filters-toggle { display: flex; }
  .filters-body {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height .35s cubic-bezier(.4,0,.2,1), opacity .25s ease;
  }
  .filters-body.expanded {
    opacity: 1;
    max-height: min(70vh, 900px);
    overflow-y: auto;
  }
  .cat-list { max-height: 160px; }

  /* flex-basis:100% fuerza al nav a bajar siempre a su propia fila completa en vez de
     dejar que el texto de la marca se achique palabra por palabra para hacerle lugar. */
  .brand { min-width: 0; }
  .header-nav { flex: 1 0 100%; justify-content: center; gap: 4px; }
}

@media (max-width: 640px) {
  .header-inner { padding: 10px 16px; }
  .brand-icon img { height: 36px; }
  .brand-title { font-size: .9rem; }
  .nav-link { padding: 6px 10px; font-size: .8rem; }

  .hero { padding: 28px 16px 32px; }
  .hero-title { font-size: 1.25rem; }
  .hero-sub { font-size: .85rem; }
  .search-bar { flex-wrap: wrap; border-radius: 16px; padding: 10px; }
  .search-input { flex: 1 1 100%; min-width: 0; padding: 8px 4px; }
  .mic-btn { flex: 0 0 auto; }
  .search-btn { flex: 1 1 auto; justify-content: center; }

  .avisos-page { padding: 24px 16px 40px; }

  .main-layout { padding: 20px 16px; }
  .toolbar { gap: 10px; }
  .card-header { flex-wrap: wrap; }

  .modal-box { padding: 22px; }
  .modal-grid { grid-template-columns: 1fr; }
}
