/* ============================================================
   app.css — Estilos globales Mesa de Partes Virtual
   Paleta: Primary #074065 | Secondary #2d9ed4 | Neutral #86b72e
   ============================================================ */

@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  src: url('../fonts/roboto-v32-latin-regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  src: url('../fonts/roboto-v32-latin-700.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 900;
  src: url('../fonts/roboto-v32-latin-900.woff2') format('woff2');
  font-display: swap;
}

:root {
  --mp-primary:       #074065;
  --mp-primary-dark:  #052d47;
  --mp-secondary:     #2d9ed4;
  --mp-secondary-lt:  #5ab5e0;
  --mp-neutral:       #86b72e;
  --mp-neutral-lt:    rgba(134,183,46,0.15);
  --mp-white:         #ffffff;
  --mp-body-bg:       #f0f4f8;
  --mp-sidebar-w:     250px;
  --mp-navbar-h:      56px;
}

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

body {
  font-family: 'Roboto', sans-serif;
  background-color: var(--mp-body-bg);
  color: #212529;
  font-size: 0.925rem;
}

/* ================================================================
   NAVBAR
   ================================================================ */
.navbar-mp {
  background-color: var(--mp-primary) !important;
  height: var(--mp-navbar-h);
  box-shadow: 0 2px 10px rgba(0,0,0,0.28);
  z-index: 1040;
  padding: 0 1rem;
}
.navbar-mp .navbar-brand {
  font-weight: 900;
  font-size: 1.05rem;
  color: #fff !important;
  letter-spacing: 0.3px;
  line-height: 1.2;
}
.navbar-mp .navbar-brand small {
  font-size: 0.65rem;
  font-weight: 400;
  opacity: 0.75;
  display: block;
}
.navbar-mp .nav-icon-btn {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  transition: background 0.2s;
}
.navbar-mp .nav-icon-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.navbar-mp .dropdown-toggle { color: rgba(255,255,255,0.9); text-decoration: none; font-size: 0.875rem; }
.navbar-mp .dropdown-toggle:hover { color: #fff; }

/* ================================================================
   SIDEBAR
   ================================================================ */
#sidebar {
  background-color: var(--mp-primary);
  width: var(--mp-sidebar-w);
  min-height: 100vh;
  position: fixed;
  top: var(--mp-navbar-h);
  left: 0;
  bottom: 0;
  z-index: 1030;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  transition: transform 0.3s ease;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.2) transparent;
}
#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-track { background: transparent; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 4px; }

.sidebar-heading {
  color: rgba(255,255,255,0.38);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  padding: 1.2rem 1.1rem 0.35rem;
  white-space: nowrap;
}
#sidebar .nav-link {
  color: rgba(255,255,255,0.72);
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  margin: 1px 8px;
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  transition: background 0.18s, color 0.18s;
  white-space: nowrap;
  text-decoration: none;
}
#sidebar .nav-link i { font-size: 1rem; flex-shrink: 0; }
#sidebar .nav-link:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
#sidebar .nav-link.active {
  color: #fff;
  background: var(--mp-secondary);
  font-weight: 700;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.42);
  z-index: 1029;
}

@media (max-width: 991.98px) {
  #sidebar { transform: translateX(-100%); top: 0; z-index: 1050; }
  #sidebar.sidebar-open { transform: translateX(0); }
  .sidebar-overlay.sidebar-open { display: block; }
}

/* ================================================================
   PAGE CONTENT WRAPPER
   ================================================================ */
#page-content-wrapper {
  margin-left: var(--mp-sidebar-w);
  padding-top: var(--mp-navbar-h);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}
@media (max-width: 991.98px) {
  #page-content-wrapper { margin-left: 0; }
}
.page-body { padding: 1.5rem 1.25rem; flex: 1; }
@media (min-width: 768px) { .page-body { padding: 1.75rem 2rem; } }

/* ================================================================
   PAGE HEADER
   ================================================================ */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.page-title {
  font-weight: 900;
  color: var(--mp-primary);
  font-size: 1.35rem;
  margin: 0;
  line-height: 1.2;
}
.page-subtitle {
  color: #6c757d;
  font-size: 0.85rem;
  margin: 2px 0 0;
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
  border: 1px solid var(--mp-neutral-lt);
  border-radius: 10px;
  box-shadow: 0 1px 5px rgba(0,0,0,0.06);
}
.card-header-mp {
  background-color: var(--mp-primary);
  color: #fff;
  border-radius: 10px 10px 0 0 !important;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-bottom: none;
}
.card-header-secondary {
  background-color: var(--mp-secondary);
  color: #fff;
  border-radius: 10px 10px 0 0 !important;
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-bottom: none;
}

/* Stat cards */
.stat-card { border-left: 4px solid var(--mp-secondary); }
.stat-card .stat-value { font-size: 2rem; font-weight: 900; color: var(--mp-primary); line-height: 1; }
.stat-card .stat-label { font-size: 0.82rem; color: #6c757d; margin-top: 4px; }
.stat-card .stat-icon { font-size: 2.2rem; color: var(--mp-neutral); opacity: 0.55; }
.stat-card.stat-warning { border-left-color: #ffc107; }
.stat-card.stat-danger  { border-left-color: #dc3545; }
.stat-card.stat-success { border-left-color: #198754; }

/* ================================================================
   BUTTONS
   ================================================================ */
.btn-mp-primary {
  background-color: var(--mp-primary);
  border-color: var(--mp-primary);
  color: #fff;
  font-weight: 700;
}
.btn-mp-primary:hover, .btn-mp-primary:focus {
  background-color: var(--mp-primary-dark);
  border-color: var(--mp-primary-dark);
  color: #fff;
}
.btn-mp-secondary {
  background-color: var(--mp-secondary);
  border-color: var(--mp-secondary);
  color: #fff;
  font-weight: 700;
}
.btn-mp-secondary:hover, .btn-mp-secondary:focus {
  background-color: #1e87bb;
  border-color: #1e87bb;
  color: #fff;
}

/* ================================================================
   TABLES
   ================================================================ */
.table-mp > thead {
  background-color: var(--mp-primary);
  color: #fff;
}
.table-mp > thead th { font-weight: 700; border-color: rgba(255,255,255,0.15); white-space: nowrap; }
.table-mp > tbody tr:hover { background-color: rgba(45,158,212,0.07); }
.table-mp td, .table-mp th { vertical-align: middle; }

/* ================================================================
   BADGES
   ================================================================ */
.badge-estado {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.32em 0.7em;
  border-radius: 20px;
  white-space: nowrap;
}

/* ================================================================
   FILTROS / SEARCH BAR
   ================================================================ */
.filter-bar {
  background: #fff;
  border: 1px solid var(--mp-neutral-lt);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.filter-bar label { font-size: 0.78rem; font-weight: 700; color: #495057; margin-bottom: 3px; }

/* ================================================================
   TABS
   ================================================================ */
.nav-tabs-mp {
  border-bottom: 2px solid var(--mp-neutral-lt);
  gap: 0.25rem;
}
.nav-tabs-mp .nav-link {
  color: #6c757d;
  font-weight: 700;
  font-size: 0.875rem;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  padding: 0.6rem 1rem;
  transition: color 0.2s, border-color 0.2s;
}
.nav-tabs-mp .nav-link:hover { color: var(--mp-primary); border-bottom-color: rgba(7,64,101,0.3); }
.nav-tabs-mp .nav-link.active { color: var(--mp-secondary); border-bottom-color: var(--mp-secondary); background: none; }

/* ================================================================
   TIMELINE (Historial)
   ================================================================ */
.timeline { position: relative; padding-left: 2rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 9px; top: 0; bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--mp-secondary), var(--mp-neutral-lt));
}
.timeline-item { position: relative; margin-bottom: 1.25rem; }
.timeline-dot {
  position: absolute;
  left: -1.65rem; top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--mp-secondary);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px var(--mp-secondary);
}
.timeline-dot.terminal { background: #dc3545; box-shadow: 0 0 0 2px #dc3545; }
.timeline-body {
  background: #fff;
  border: 1px solid var(--mp-neutral-lt);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
}
.timeline-date { font-size: 0.75rem; color: #6c757d; }

/* ================================================================
   LOGIN PAGES
   ================================================================ */
.login-wrapper {
  min-height: 100vh;
  background: linear-gradient(140deg, var(--mp-primary) 0%, #0d6298 55%, var(--mp-secondary) 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-card {
  width: 100%;
  max-width: 430px;
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.28);
  overflow: hidden;
  border: none;
}
.login-header {
  background-color: var(--mp-primary);
  color: #fff;
  padding: 2rem 1.75rem 1.5rem;
  text-align: center;
  border-bottom: 3px solid var(--mp-secondary);
}
.login-icon-wrap {
  width: 70px; height: 70px;
  background: rgba(255,255,255,0.12);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1rem;
  font-size: 2rem;
}
.login-title { font-size: 1.2rem; font-weight: 900; margin: 0; }
.login-subtitle { font-size: 0.82rem; opacity: 0.75; margin-top: 4px; }

/* ================================================================
   ALERTS CONTAINER
   ================================================================ */
#alert-container {
  position: fixed;
  top: calc(var(--mp-navbar-h) + 12px);
  right: 16px;
  z-index: 1060;
  width: 360px;
  max-width: calc(100vw - 32px);
}
#alert-container .alert { font-size: 0.875rem; }

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.72);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.spinner-mp {
  width: 3rem; height: 3rem;
  border-color: var(--mp-primary);
  border-right-color: transparent;
}

/* ================================================================
   MISC UTILITIES
   ================================================================ */
.fw-black       { font-weight: 900; }
.text-mp-primary { color: var(--mp-primary) !important; }
.text-mp-secondary { color: var(--mp-secondary) !important; }
.bg-mp-primary  { background-color: var(--mp-primary) !important; }
.bg-mp-secondary { background-color: var(--mp-secondary) !important; }
.border-mp      { border-color: var(--mp-neutral) !important; }
.cursor-pointer { cursor: pointer; }
.vencido-row    { background-color: rgba(220,53,69,0.06) !important; }
.empty-state    { text-align: center; padding: 3rem 1rem; color: #adb5bd; }
.empty-state i  { font-size: 3rem; margin-bottom: 1rem; display: block; }
.avatar-circle {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--mp-secondary);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ================================================================
   FOOTER
   ================================================================ */
.footer-mp {
  font-size: 0.78rem;
  color: #9ca3af;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--mp-neutral-lt);
  text-align: center;
}
