/* ==========================================================================
   Presupuestos Vigentes - Dark + Municipal Green Modern Dashboard
   Municipalidad de San Ramón de la Nueva Orán
   ========================================================================== */

:root {
  --pv-bg: #0B0F19;
  --pv-surface: #131C2E;
  --pv-surface-hover: #18233A;
  --pv-surface-alt: #162035;
  --pv-border: #1E293B;
  --pv-border-light: #334155;
  --pv-green-primary: #008D48;
  --pv-green-vivid: #10B981;
  --pv-green-glow: rgba(16, 185, 129, 0.15);
  --pv-green-pastel: rgba(16, 185, 129, 0.12);
  --pv-text-primary: #F8FAFC;
  --pv-text-secondary: #94A3B8;
  --pv-text-muted: #64748B;
  --pv-radius-lg: 16px;
  --pv-radius-md: 12px;
  --pv-radius-sm: 8px;
  --pv-radius-pill: 999px;
  --pv-font: 'Open Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Base Page Wrapper */
.pv-page-wrapper {
  background-color: var(--pv-bg) !important;
  color: var(--pv-text-primary) !important;
  font-family: var(--pv-font) !important;
  min-height: 100vh;
  padding-bottom: 80px;
}

.pv-page-wrapper *,
.pv-page-wrapper *::before,
.pv-page-wrapper *::after {
  box-sizing: border-box;
}

.pv-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ==========================================================================
   Reveal on Scroll & Smooth Entrance Animations
   ========================================================================== */
.pv-reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.pv-reveal.pv-is-visible {
  opacity: 1;
  transform: translateY(0);
}

.pv-delay-1 { transition-delay: 0.08s; }
.pv-delay-2 { transition-delay: 0.16s; }
.pv-delay-3 { transition-delay: 0.24s; }
.pv-delay-4 { transition-delay: 0.32s; }

/* Hero Section */
.pv-hero {
  position: relative;
  background: radial-gradient(circle at 50% 0%, #0d281a 0%, #0B0F19 75%);
  border-bottom: 1px solid var(--pv-border);
  padding: 65px 0 50px 0;
  overflow: hidden;
}

.pv-hero::before {
  content: "";
  position: absolute;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  width: 650px;
  height: 320px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.2) 0%, transparent 70%);
  filter: blur(45px);
  pointer-events: none;
}

.pv-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--pv-green-pastel);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 6px 16px;
  border-radius: var(--pv-radius-pill);
  font-size: 13px;
  font-weight: 600;
  color: #34D399;
  letter-spacing: 0.04em;
  margin-bottom: 18px;
}

.pv-hero__badge a {
  color: #94A3B8;
  text-decoration: none;
  transition: color 0.2s ease;
}

.pv-hero__badge a:hover {
  color: #FFFFFF;
}

.pv-hero__badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--pv-green-vivid);
  box-shadow: 0 0 10px var(--pv-green-vivid);
}

.pv-hero__title {
  font-size: clamp(2rem, 3.5vw, 2.75rem);
  font-weight: 800;
  color: #FFFFFF !important;
  line-height: 1.2;
  margin: 0 0 14px 0;
  letter-spacing: -0.02em;
}

.pv-hero__subtitle {
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--pv-text-secondary);
  max-width: 820px;
  margin: 0;
}

/* KPI Cards Grid */
.pv-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: -30px;
  margin-bottom: 45px;
  position: relative;
  z-index: 5;
}

.pv-kpi-card {
  background: var(--pv-surface);
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-radius-lg);
  padding: 24px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
  transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.pv-kpi-card:hover {
  transform: translateY(-4px);
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 14px 30px -5px rgba(16, 185, 129, 0.18);
}

.pv-kpi-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.pv-kpi-card__icon {
  width: 48px;
  height: 48px;
  border-radius: var(--pv-radius-md);
  background: var(--pv-green-pastel);
  color: var(--pv-green-vivid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.pv-kpi-card__badge {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--pv-radius-pill);
  background: rgba(255, 255, 255, 0.06);
  color: #CBD5E1;
  border: 1px solid var(--pv-border);
}

.pv-kpi-card__badge--green {
  background: rgba(16, 185, 129, 0.15);
  color: #34D399;
  border-color: rgba(16, 185, 129, 0.3);
}

.pv-kpi-card__value {
  font-size: 2.1rem;
  font-weight: 800;
  color: #FFFFFF;
  line-height: 1.1;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.pv-kpi-card__label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--pv-text-secondary);
  margin: 0;
}

.pv-kpi-card__desc {
  font-size: 0.8rem;
  color: var(--pv-text-muted);
  margin-top: 6px;
}

/* Charts Section */
.pv-charts-section {
  margin-bottom: 50px;
}

.pv-section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.45rem;
  font-weight: 700;
  color: #FFFFFF !important;
  margin: 0 0 24px 0;
}

.pv-section-title i {
  color: var(--pv-green-vivid);
  font-size: 1.25rem;
}

.pv-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 24px;
  margin-bottom: 24px;
}

.pv-chart-card {
  background: var(--pv-surface);
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-radius-lg);
  padding: 24px 26px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.pv-chart-card--full {
  grid-column: 1 / -1;
}

.pv-chart-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pv-chart-card__title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #FFFFFF !important;
  margin: 0;
}

.pv-chart-card__subtitle {
  font-size: 0.82rem;
  color: var(--pv-text-muted);
  margin-top: 3px;
}

.pv-chart-container {
  min-height: 290px;
  width: 100%;
}

/* Documents Section */
.pv-docs-section {
  background: var(--pv-surface-alt);
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-radius-lg);
  padding: 36px 32px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.pv-docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--pv-border);
}

/* ==========================================================================
   Search Form & Button - Complete Isolation & Custom Styling
   ========================================================================== */
.pv-page-wrapper .pv-search-form,
form.pv-search-form {
  all: unset !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  background: #0B0F19 !important;
  border: 1px solid #334155 !important;
  border-radius: 999px !important;
  padding: 4px 6px 4px 18px !important;
  width: 100% !important;
  max-width: 400px !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3) !important;
  transition: border-color 0.25s ease, box-shadow 0.25s ease !important;
}

.pv-page-wrapper .pv-search-form:focus-within,
form.pv-search-form:focus-within {
  border-color: #10B981 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25), 0 6px 18px rgba(0, 0, 0, 0.4) !important;
}

.pv-page-wrapper .pv-search-form input[type="search"],
.pv-page-wrapper input.pv-search-input,
form.pv-search-form input[type="search"] {
  all: unset !important;
  box-sizing: border-box !important;
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: #FFFFFF !important;
  font-family: var(--pv-font) !important;
  font-size: 0.92rem !important;
  line-height: 1.4 !important;
  padding: 9px 12px 9px 4px !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
}

.pv-page-wrapper .pv-search-form input[type="search"]::placeholder,
form.pv-search-form input[type="search"]::placeholder {
  color: #64748B !important;
  opacity: 1 !important;
}

.pv-page-wrapper .pv-search-form button.pv-search-btn,
.pv-page-wrapper button.pv-search-btn,
form.pv-search-form button[type="submit"].pv-search-btn {
  all: unset !important;
  box-sizing: border-box !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  background: #008D48 !important;
  color: #FFFFFF !important;
  border: 1px solid transparent !important;
  border-radius: 999px !important;
  padding: 9px 20px !important;
  font-family: var(--pv-font) !important;
  font-size: 0.86rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.02em !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease !important;
  box-shadow: 0 2px 10px rgba(0, 141, 72, 0.35) !important;
}

.pv-page-wrapper .pv-search-form button.pv-search-btn:hover,
form.pv-search-form button[type="submit"].pv-search-btn:hover {
  background: #00763C !important;
  color: #FFFFFF !important;
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4) !important;
}

/* Document Cards Grid */
.pv-docs-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.pv-doc-card {
  background: var(--pv-surface);
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.pv-doc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.45);
}

.pv-doc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.pv-doc-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 3px 10px;
  border-radius: var(--pv-radius-pill);
  background: rgba(16, 185, 129, 0.12);
  color: #34D399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pv-doc-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #FFFFFF !important;
  margin: 0 0 8px 0;
  line-height: 1.35;
}

.pv-doc-title a {
  color: #FFFFFF !important;
  text-decoration: none;
  transition: color 0.2s ease;
}

.pv-doc-title a:hover {
  color: var(--pv-green-vivid) !important;
}

.pv-doc-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--pv-text-muted);
  margin-bottom: 12px;
}

.pv-doc-desc {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--pv-text-secondary);
  margin: 0 0 16px 0;
}

.pv-doc-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pv-btn-view {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--pv-green-primary);
  color: #FFFFFF !important;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--pv-radius-pill);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 141, 72, 0.3);
}

.pv-btn-view:hover {
  background: #00763C;
  color: #FFFFFF !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.pv-btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid #334155;
  color: #E2E8F0 !important;
  text-decoration: none;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: var(--pv-radius-pill);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.pv-btn-download:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: #64748B;
  color: #FFFFFF !important;
}

/* Empty State */
.pv-empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--pv-text-secondary);
}

/* Pagination */
.pv-pagination {
  margin-top: 36px;
  display: flex;
  justify-content: center;
}

.pv-pagination .page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  margin: 0 4px;
  background: var(--pv-surface);
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-radius-sm);
  color: var(--pv-text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.pv-pagination .page-numbers.current,
.pv-pagination .page-numbers:hover {
  background: var(--pv-green-primary);
  border-color: var(--pv-green-primary);
  color: #FFFFFF;
}

/* Single Template Modern Dark Styles */
.pv-single-wrapper {
  background-color: var(--pv-bg) !important;
  color: var(--pv-text-primary) !important;
  font-family: var(--pv-font) !important;
  min-height: 100vh;
  padding-bottom: 80px;
}

.pv-single-container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 40px 24px;
}

.pv-single-card {
  background: var(--pv-surface);
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-radius-lg);
  padding: 32px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  margin-bottom: 30px;
}

.pv-single-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}

.pv-viewer-frame {
  width: 100%;
  height: 82vh;
  min-height: 600px;
  border: 1px solid var(--pv-border);
  border-radius: var(--pv-radius-md);
  background: #070A10;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

.pv-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #34D399;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s ease, transform 0.2s ease;
}

.pv-back-link:hover {
  color: #FFFFFF;
  transform: translateX(-4px);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .pv-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .pv-charts-grid {
    grid-template-columns: 1fr;
  }
  .pv-docs-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .pv-kpis {
    grid-template-columns: 1fr;
    margin-top: 20px;
  }
  .pv-hero {
    padding: 40px 0 30px 0;
  }
  .pv-hero__title {
    font-size: 1.75rem;
  }
  .pv-docs-section {
    padding: 24px 16px;
  }
  .pv-viewer-frame {
    display: none;
  }
}

/* Backward compatibility for legacy templates using .presupuestos-* classes */
.presupuestos-hero { width: 100%; background: radial-gradient(circle at 50% 0%, #0d281a 0%, #0B0F19 75%); border-bottom: 1px solid #1E293B; padding: 48px 16px; }
.presupuestos-hero__inner { max-width: 1040px; margin: 0 auto; }
.presupuestos-hero__kicker { color: #34D399; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 8px; display: block; font-weight: 700; }
.presupuestos-hero__title { color: #fff !important; font-size: 2.2rem; line-height: 1.2; margin: 0; font-weight: 800; }
.presupuestos-wrap { max-width: 1040px; margin: 0 auto; padding: 36px 20px 60px; color: #F8FAFC; background: #0B0F19; }
.presupuestos-meta { color: #94A3B8; font-size: 0.88rem; margin: 0 0 16px; }
.presupuestos-single__content { margin: 16px 0 24px; color: #CBD5E1; }
.presupuestos-single__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.presupuestos-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; background: #008D48; color: #fff !important; border: 0; border-radius: 999px; font-weight: 600; text-decoration: none !important; cursor: pointer; transition: background 0.2s; }
.presupuestos-btn:hover { background: #00763C; }
.presupuestos-btn--outline { background: rgba(255, 255, 255, 0.08); color: #E2E8F0 !important; border: 1px solid #334155; }
.presupuestos-btn--outline:hover { background: rgba(255, 255, 255, 0.15); border-color: #64748B; }
.presupuestos-viewer { width: 100%; height: 80vh; min-height: 600px; border: 1px solid #1E293B; border-radius: 12px; background: #070A10; }
.presupuestos-back { display: inline-flex; align-items: center; gap: 8px; margin-top: 24px; color: #34D399; text-decoration: none; font-weight: 600; }
.presupuestos-back:hover { color: #fff; }
