/* styles.css - Global custom styles for Lazo project */

/* ===== Layout Vars ===== */
:root {
  --navbar-height: 64px;
  --sidebar-width: 260px;

  /* Extras para UI moderna */
  --radius-lg: 1rem;
  --radius-sm: .5rem;
  --shadow-1: 0 6px 18px rgba(0,0,0,.08);
  --shadow-2: 0 10px 24px rgba(0,0,0,.12);
}

/* ===== Base & Typography ===== */
html, body {
  margin: 0;
  padding: 0;
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #333;
  background-color: #f8f9fa;
  overflow-x: hidden;
}

body { padding-top: var(--navbar-height); }

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 1rem 0;
  font-weight: 500;
  color: #28a745;
}
h2 { font-size: 1.75rem; }

/* ===== Navbar/Header ===== */
.navbar {
  background-color: #28a745;
  border-bottom: 1px solid #1e7e34;
  min-height: var(--navbar-height);
  z-index: 1030;
}
.navbar-brand { color: #ffffff !important; font-weight: bold; }
.navbar-toggler { border-color: rgba(255,255,255,0.1); }
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'><path stroke='rgba%28255, 255, 255, 0.7%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/></svg>");
}
.navbar-brand img { height: calc(var(--navbar-height) - 20px); width: auto; }

/* ===== Layout Wrappers ===== */
#wrapper { display: flex; min-height: calc(100vh - var(--navbar-height)); }

/* Tema verde + texto negro para el sidebar */
.sidebar-menu {
  /* Bootstrap 5 usa estas CSS vars para nav-pills activos */
  --bs-nav-pills-link-active-bg: #9eeaf9; /* verde */
  --bs-nav-pills-link-active-color: #000; /* negro */
}

/* Texto negro en los links del sidebar */
.sidebar-menu .nav-link {
  color: #000 !important;
}

/* Hover suave en los links */
.sidebar-menu .nav-link:hover {
  background-color: #e6f4ea; /* verde muy claro */
  color: #000 !important;
}

/* Asegurar que los items activos tengan texto negro, por si hay herencias */
.sidebar-menu .nav-link.active,
.sidebar-menu .show > .nav-link {
  color: #000 !important;
}

/* Que los íconos sigan el color del texto */
.sidebar-menu .nav-link i {
  color: inherit;
}
.cal-day a { color: inherit; text-decoration: none; }
.cal-day a:hover { text-decoration: underline; }

/* Contenido + footer */
#page-content-wrapper {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background-color: #ffffff;
}
#page-content-wrapper main { flex-grow: 1; }

/* ===== Sidebar: Estilos responsive unificados ===== */
/* Escritorio (>= md) */
@media (min-width: 768px) {
  #sidebar-wrapper {
    width: var(--sidebar-width);
    background-color: #f8f9fa;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
  }
}
/* Móvil (< md) */
@media (max-width: 767.98px) {
  #sidebar-wrapper { display: none; }
}

/* ===== Cards modernas (para el panel) ===== */
.card-modern{
  border: 1px solid rgba(0,0,0,.06);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-1);
  transition: transform .2s ease, box-shadow .2s ease;
}
.card-modern:hover{
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
}
.card-modern .card-body{ padding: 1rem; }
@media (min-width: 768px){ .card-modern .card-body{ padding: 1.25rem; } }

.card-modern h3 .fa,
.card-modern h3 .fas,
.card-modern h3 .bi{ opacity:.9; }
.card-modern p.text-muted{ margin-bottom:.5rem; }

/* Alerts compactas en móvil */
.alert{ padding:.5rem .75rem; border-radius: var(--radius-sm); }
.alert h4{ font-size: 1.25rem; }

/* Progresos más compactos */
.progress{ height: 20px; }
@media (max-width: 575.98px){ .progress{ height: 16px; } }

/* ===== Botones ===== */
.btn { white-space: nowrap; border-radius: .65rem; }

/* Primarios (tu paleta) */
.btn-primary { background-color: #28a745; border-color: #28a745; }
.btn-primary:hover { background-color: #218838; border-color: #1e7e34; }
.btn-secondary { background-color: #6c757d; border-color: #6c757d; }
.btn-secondary:hover { background-color: #5a6268; border-color: #545b62; }
.btn-warning { background-color: #ffc107; border-color: #ffc107; color: #212529; }
.btn-warning:hover { background-color: #e0a800; border-color: #d39e00; }
.btn-danger { background-color: #dc3545; border-color: #dc3545; }
.btn-danger:hover { background-color: #c82333; border-color: #bd2130; }

/* Outline (necesarios en el panel) */
.btn-outline-primary{ color:#28a745; border-color:#28a745; }
.btn-outline-primary:hover{ background:#28a745; color:#fff; }
.btn-outline-success{ color:#198754; border-color:#198754; }
.btn-outline-success:hover{ background:#198754; color:#fff; }
.btn-outline-danger{ color:#dc3545; border-color:#dc3545; }
.btn-outline-danger:hover{ background:#dc3545; color:#fff; }

/* Botones dentro de tabla */
table .btn{ padding: 0.25rem 0.5rem; font-size: 0.75rem; }

/* ===== Tablas (desktop): responsive + header sticky ===== */
.table-responsive{
  width: 100%;
  margin-top: 20px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table{
  width: 100%;
  margin-bottom: 1rem;
  color: #212529;
  border-collapse: collapse;
}
table th, table td{
  padding: 0.75rem;
  vertical-align: middle;
  border-top: 1px solid #dee2e6;
}
table thead th{
  background-color: #28a745;
  color: #ffffff;
  border-color: #218838;
  position: sticky;     /* Encabezado fijo al hacer scroll */
  top: 0;
  z-index: 1;
  box-shadow: 0 1px 0 rgba(0,0,0,.06);
}
.table-striped tbody tr:nth-of-type(odd){ background-color: rgba(0, 0, 0, 0.05); }
.table-bordered th, .table-bordered td{ border: 1px solid #dee2e6; }

/* Primera columna fija (útil en estadísticas dentro de card) */
.card-modern .table thead th:first-child,
.card-modern .table tbody td:first-child{
  position: sticky;
  left: 0;
  background: #fff;
  z-index: 2;
}

/* ===== Tablas (móvil): vista tipo tarjeta ===== */
/* Mantengo tu enfoque de "tabla a tarjetas" en móvil para máxima legibilidad */
@media (max-width: 767.98px) {
  .table-responsive { overflow-x: hidden; }
  table, thead, tbody, th, td, tr { display: block; }
  thead tr { position: absolute; top: -9999px; left: -9999px; }
  tr { border: 1px solid #dee2e6; margin-bottom: 0.5rem; border-radius: .5rem; overflow:hidden; }
  td {
    border: none; border-bottom: 1px solid #dee2e6;
    position: relative; padding-left: 50%; text-align: right;
  }
  td:before {
    position: absolute; top: 50%; left: 6px; width: 45%;
    padding-right: 10px; white-space: nowrap; content: attr(data-label);
    font-weight: bold; color: #28a745; transform: translateY(-50%); text-align: left;
  }
  td:last-child { border-bottom: none; }
  /* Botones de acción en móvil */
  .btn-warning, .btn-danger { padding: 0.2rem 0.4rem; font-size: 0.75rem; }
}

/* ===== Paginación compacta ===== */
.pagination{ gap:.25rem; }
.pagination .page-link{ padding:.25rem .55rem; border-radius:.5rem; }
.pagination .page-item.active .page-link{
  background:#28a745; border-color:#28a745;
}

/* ===== Gráficos (Chart.js) ===== */
canvas{
  max-width: 100% !important;
  height: auto !important;
  display: block;
}

/* ===== Listas / enlaces largos ===== */
.list-group-item{
  display:flex; align-items:center; gap:.5rem;
  white-space:nowrap; text-overflow:ellipsis; overflow:hidden;
}
.list-group-item i{ min-width:1.1rem; }

/* ===== News carousel centrado (si lo usas en index) ===== */
.news-carousel{
  margin: 90px auto 80px auto;
  position: relative;
  width: 100%;
}
@media (min-width: 992px){
  .news-carousel{ width: 50%; }
}

/* ===== Utilidades y ajustes finos ===== */
small, .small{ font-size:.82rem; }
h3.h5{ font-size:1.05rem; }

@media (max-width: 575.98px){
  .row.g-4 > [class*="col-"]{ padding-left:.4rem; padding-right:.4rem; }
  .card-modern .btn{ padding:.35rem .6rem; font-size:.86rem; }
  .card-modern .table{ font-size:.9rem; }
  .badge{ font-size:.74rem; padding:.35em .55em; }
}

/* ===== Formularios (tuyos, se mantienen) ===== */
input, select, textarea { max-width: 100%; box-sizing: border-box; }
.row.g-3 { display: flex; flex-wrap: wrap; margin: 0 -0.5rem; }
.row.g-3 > [class*="col-"] { padding: 0 0.5rem; flex: 1 1 100%; margin-bottom: 1rem; }
@media (min-width: 768px) {
  .row.g-3 > .col-md-2 { flex: 0 0 16.6667%; width: 16.6667%; }
  .row.g-3 > .col-md-3 { flex: 0 0 25%; width: 25%; }
  .row.g-3 > .col-md-4 { flex: 0 0 33.3333%; width: 33.3333%; }
  .row.g-3 > .col-md-6 { flex: 0 0 50%; width: 50%; }
}

/* ===== Footer ===== */
.footer, .site-footer {
  background-color: #343a40;
  color: #ffffff;
  padding: 15px 0;
  text-align: center;
  width: 100%;
}

/* ===== Accesibilidad: reducir animación si el usuario lo pide ===== */
@media (prefers-reduced-motion: reduce){
  *{ transition:none !important; animation:none !important; }
}
