/* ── Variables ─────────────────────────────────────────── */
:root {
  --rokys-red:      #c0392b;
  --rokys-dark:     #922b21;
  --sidebar-bg:     #1e3a5f;
  --sidebar-hover:  rgba(255,255,255,0.09);
  --sidebar-active: rgba(255,255,255,0.15);
  --body-bg:        #f1f5f9;
  --sidebar-width:  240px;
}

/* ── General ────────────────────────────────────────────── */
body {
  background: var(--body-bg);
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 0.9rem;
  color: #1e293b;
  -webkit-font-smoothing: antialiased;
}

h1,h2,h3,h4,h5,h6 { font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-weight: 600; }
.fw-semibold { font-weight: 500 !important; }
.fw-bold     { font-weight: 600 !important; }

.btn-xs { padding: 0.15rem 0.4rem; font-size: 0.75rem; }

/* ── Color corporativo ─────────────────────────────────── */
.bg-rokys   { background: var(--rokys-red) !important; }
.btn-rokys  { background: var(--rokys-red); color: #fff; border: none; font-weight: 500; letter-spacing: 0.01em; }
.btn-rokys:hover { background: var(--rokys-dark); color: #fff; }

/* ── Paginación (estilo propio, pill moderno) ──────────────
   Editado/modificado por Marco Padilla — usada en listados largos (ej. modules/despacho/checklist/
   index.php); clase propia (.pagination-rokys) para no heredar/alterar el look de ".pagination" de
   Bootstrap usado en otras pantallas (ej. modules/bitacora/index.php). */
.pagination-rokys {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pagination-rokys .pgr-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 999px;
  color: #475569;
  font-weight: 500;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background-color .15s ease, color .15s ease;
}
.pagination-rokys .pgr-link:hover:not(.disabled):not(.active) { background: #e2e8f0; color: #1e293b; }
.pagination-rokys .pgr-link.active {
  background: var(--rokys-red);
  color: #fff;
  box-shadow: 0 2px 6px rgba(192,57,43,0.35);
}
.pagination-rokys .pgr-link.disabled { color: #cbd5e1; pointer-events: none; }
.pagination-rokys .pgr-nav { color: #64748b; }
.pagination-rokys .pgr-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 2rem;
  color: #94a3b8;
}

/* ── LOGIN ─────────────────────────────────────────────── */
.login-body {
  min-height: 100vh;
  background: linear-gradient(135deg, #c0392b 0%, #1e3a5f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.login-container { width: 100%; max-width: 440px; }
.login-card { border-radius: 1rem; }
.login-logo {
  width: 70px; height: 70px;
  background: var(--rokys-red);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
  font-size: 2rem; color: #fff;
}

/* ── LAYOUT ─────────────────────────────────────────────── */
.wrapper { min-height: 100vh; padding-top: 56px; }

.sidebar {
  width: var(--sidebar-width);
  min-height: calc(100vh - 56px);
  position: sticky; top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  flex-shrink: 0;
  background: var(--sidebar-bg) !important;
}

.main-content {
  min-height: calc(100vh - 56px);
  overflow-x: hidden;
}

/* ── NAVBAR ─────────────────────────────────────────────── */
.navbar {
  background: #fff !important;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.navbar-brand { font-weight: 600; font-size: 1rem; color: #1e293b !important; }

/* ── SIDEBAR ────────────────────────────────────────────── */
.sidebar .nav-link {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 0.84rem;
  font-weight: 400;
  padding: 0.38rem 0.8rem;
  color: rgba(255,255,255,0.72);
  border-radius: 6px;
  transition: background 0.13s, color 0.13s;
  letter-spacing: 0.01em;
}
.sidebar .nav-link:hover {
  color: #fff;
  background: var(--sidebar-hover);
}
.sidebar .nav-link.active {
  color: #fff;
  background: var(--sidebar-active);
  font-weight: 500;
}
.sidebar .nav-link i { opacity: 0.85; }
.sidebar .nav-link.active i { opacity: 1; }

.nav-section-title {
  font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: #f59e0b;
  background: rgba(245,158,11,0.1);
  border-left: 3px solid #f59e0b;
  padding: 0.28rem 0.6rem !important;
  margin-top: 0.5rem;
  margin-bottom: 0.2rem;
  border-radius: 0 4px 4px 0;
}

/* ── CARDS ──────────────────────────────────────────────── */
.card {
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
}
.card-header {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(0,0,0,0.08);
}

/* ── TABLES ─────────────────────────────────────────────── */
.table {
  font-size: 0.875rem;
}
.table thead th {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
}
.table-dark thead th {
  color: rgba(255,255,255,0.85);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
}

/* ── BADGES ─────────────────────────────────────────────── */
.badge {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

/* ── FORMS ──────────────────────────────────────────────── */
.form-label {
  font-size: 0.84rem;
  font-weight: 500;
  color: #334155;
  margin-bottom: 0.3rem;
}
.form-control, .form-select {
  font-size: 0.875rem;
  border-color: #cbd5e1;
  border-radius: 7px;
}
.form-control:focus, .form-select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}

/* ── BUTTONS ────────────────────────────────────────────── */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.875rem;
  border-radius: 7px;
  letter-spacing: 0.01em;
}
.btn-primary   { background: #2563eb; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

/* ── KPI CARDS ──────────────────────────────────────────── */
.kpi-card { transition: transform 0.15s; }
.kpi-card:hover { transform: translateY(-2px); }
.kpi-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto;
}
.kpi-value { font-size: 1.9rem; font-weight: 600; line-height: 1; letter-spacing: -0.02em; }
.kpi-label { font-size: 0.75rem; color: #64748b; margin-top: 0.3rem; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }

.bg-primary-soft { background: rgba(37,99,235,0.1); }
.bg-success-soft  { background: rgba(22,163,74,0.1); }
.bg-warning-soft  { background: rgba(245,158,11,0.12); }
.bg-danger-soft   { background: rgba(220,53,69,0.1); }

/* ── BÚSQUEDA PERSONA ───────────────────────────────────── */
.lista-busqueda {
  position: absolute;
  z-index: 1000;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  max-height: 300px;
  overflow-y: auto;
  width: calc(100% - 2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.lista-item {
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.875rem;
}
.lista-item:hover { background: #f8fafc; }
.lista-no-auth { background: #fff5f5; }
.lista-no-auth:hover { background: #ffecec; }
.lista-no-encontrado { color: #94a3b8; font-style: italic; }
.lista-no-encontrado:hover { background: #fefce8; color: #854d0e; }

.input-group { position: relative; }
#resultadoBusqueda { position: absolute; top: 100%; left: 0; right: 0; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
/* Botón hamburguesa: solo visible en pantallas chicas */
.btn-sidebar-toggle { display: none; }

/* Editado/modificado por Marco Padilla — breakpoint subido de 991px a 1199px: una tablet en
   horizontal (ej. iPad ~1024px, iPad Pro ~1194px) supera 991px y quedaba con el sidebar fijo, sin
   botón para ocultarlo, aunque en vertical (~768px) sí entraba en este breakpoint y funcionaba bien */
@media (max-width: 1199px) {
  .btn-sidebar-toggle { display: inline-flex !important; align-items: center; }

  /* El sidebar pasa a ser un cajón deslizable */
  .sidebar {
    position: fixed;
    top: 56px; left: 0;
    height: calc(100vh - 56px);
    width: 250px;
    z-index: 1045;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 2px 0 14px rgba(0,0,0,.25);
  }
  .sidebar.open { transform: translateX(0); }

  /* Contenido a todo el ancho */
  .main-content { padding: 1rem !important; width: 100%; }

  /* Fondo oscuro al abrir el menú */
  .sidebar-backdrop {
    position: fixed; inset: 56px 0 0 0;
    background: rgba(0,0,0,.45);
    z-index: 1044; display: none;
  }
  .sidebar-backdrop.show { display: block; }
}

/* ── SELECT CON BÚSQUEDA (ss) ───────────────────────────── */
/* Editado/modificado por Marco Padilla — flecha de dropdown para que se note que es un
   desplegable buscable (y no un input de texto libre), aplica a todo select-search del sitio */
.ss-wrap { position: relative; }
.ss-wrap::after {
  content: "";
  position: absolute;
  right: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #94a3b8;
  border-bottom: 2px solid #94a3b8;
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.ss-input { padding-right: 34px; }
.ss-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1080;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  margin-top: 2px;
}
.ss-menu.show { display: block; }
/* Editado/modificado por Marco Padilla — variante ancha para menús cuyo input vive en una
   celda angosta (ej. columna "Código" del buscador de producto en reclamos/crear.php):
   ignora el "right:0" heredado de .ss-menu y usa un ancho propio para que el contenido
   (código + nombre del producto) se lea completo en vez de quedar apretado */
.ss-menu-wide { right: auto; min-width: 100%; width: max-content; max-width: 420px; }
/* Editado/modificado por Marco Padilla — variante "flotante" posicionada por JS (position:fixed)
   para menús cuyo input vive dentro de un contenedor con overflow (ej. .table-responsive), que
   recorta cualquier hijo position:absolute que se salga verticalmente del contenedor */
.ss-menu-float {
  display: none;
  position: fixed;
  z-index: 2000;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(20,24,31,0.15);
}
.ss-menu-float.show { display: block; }
.ss-item {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 0.9rem;
  border-bottom: 1px solid #f1f5f9;
}
.ss-item:hover, .ss-item.active { background: #e8f0fe; }
.ss-empty { padding: 10px 12px; color: #94a3b8; font-size: 0.85rem; }
