/* ============================================================
   Servicio Técnico – Estilos propios (Bootstrap 5 puro)
   ============================================================ */

:root {
  --sidebar-width: 240px;
  --sidebar-bg: #1e293b;
  --sidebar-text: #cbd5e1;
  --sidebar-active-bg: #3b82f6;
  --sidebar-active-text: #ffffff;
  --sidebar-hover-bg: rgba(255,255,255,.07);
  --topbar-height: 56px;
  --primary: #3b82f6;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
}

/* ===== LAYOUT ===== */
html, body {
  height: 100%;
  font-size: 14px;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

#app-wrapper {
  height: 100vh;
}

/* ===== SIDEBAR ===== */
#sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  transition: width .25s ease, min-width .25s ease;
  overflow: hidden;
  z-index: 1040;
}

/* Desktop colapsado → mini franja de 52px */
.sidebar-collapsed #sidebar {
  width: 52px;
  min-width: 52px;
}

/* Botón hamburger dentro del sidebar */
.sidebar-toggle-btn {
  width: 36px;
  height: 36px;
  background: rgba(255,255,255,.08);
  border: none;
  border-radius: 8px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .15s;
  flex-shrink: 0;
}
.sidebar-toggle-btn:hover {
  background: rgba(255,255,255,.18);
}

.sidebar-brand {
  color: #fff;
  font-size: .95rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  white-space: nowrap;
}

.sidebar-brand:hover {
  color: #fff;
  background: rgba(255,255,255,.05);
}

.sidebar-icon-box {
  width: 32px;
  height: 32px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-user {
  min-height: 60px;
}

.sidebar-divider {
  border-color: rgba(255,255,255,.1);
  margin: .5rem 1rem;
}

.sidebar-section-label {
  font-size: .67rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #64748b;
  font-weight: 600;
  padding: .25rem .5rem 0;
  margin: 0;
}

/* Navegación sidebar */
#sidebar .nav-link {
  color: var(--sidebar-text);
  padding: .45rem .75rem;
  font-size: .83rem;
  white-space: nowrap;
  display: flex;
  align-items: center;
  transition: background .15s, color .15s;
}

#sidebar .nav-link:hover {
  background: var(--sidebar-hover-bg);
  color: #fff;
}

#sidebar .nav-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 500;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  flex-shrink: 0;
  z-index: 1030;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

/* ===== MAIN CONTENT ===== */
#main-area {
  background: #f8fafc;
}

#page-content {
  background: #f8fafc;
}

/* ===== CARDS ===== */
.card {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.card-header {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  border-radius: 10px 10px 0 0 !important;
  padding: .75rem 1.25rem;
  font-weight: 600;
  font-size: .9rem;
}

/* ===== KPI CARDS ===== */
.kpi-card {
  border-radius: 12px;
  border: none;
  color: #fff;
  overflow: hidden;
  transition: transform .15s, box-shadow .15s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}

.kpi-card .kpi-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.kpi-card .kpi-label {
  font-size: .8rem;
  opacity: .85;
}

.kpi-card .kpi-icon {
  font-size: 2.5rem;
  opacity: .2;
  position: absolute;
  right: 1rem;
  bottom: .5rem;
}

.kpi-blue   { background: linear-gradient(135deg, #3b82f6, #2563eb); }
.kpi-green  { background: linear-gradient(135deg, #22c55e, #16a34a); }
.kpi-orange { background: linear-gradient(135deg, #f59e0b, #d97706); }
.kpi-red    { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* ===== TABLAS ===== */
.table thead th {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #64748b;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}

.table-hover tbody tr:hover {
  background: #f0f7ff;
}

/* ===== BADGES de estado ===== */
.badge-estado {
  font-size: .72rem;
  padding: .3em .65em;
  border-radius: 6px;
  font-weight: 500;
}

/* ===== FORMULARIOS ===== */
.form-control, .form-select {
  border-radius: 8px;
  font-size: .875rem;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .2rem rgba(59,130,246,.2);
}

/* ===== BOTONES ===== */
.btn {
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 500;
}

.btn-xs {
  padding: .15rem .45rem;
  font-size: .72rem;
  border-radius: 5px;
}

/* ===== ALERTAS FLASH ===== */
.alert {
  border-radius: 10px;
  font-size: .875rem;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  background: transparent;
  padding: 0;
  margin: 0;
  font-size: .8rem;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "/";
  color: #94a3b8;
}

/* ===== SCROLLBAR personalizado (webkit) ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-box {
  width: 100%;
  max-width: 400px;
}

.login-card {
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.08);
  background: #fff;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

/* ===== RESPONSIVE ===== */

/* Overlay backdrop (solo visible en mobile cuando el sidebar está abierto) */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1039;
}

/* Botón hamburger flotante mobile — la visibilidad la controla JS */
#sidebarOpenBtn {
  display: none; /* JS lo muestra solo en mobile */
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1045;
  width: 40px;
  height: 40px;
  background: var(--sidebar-bg);
  border: none;
  border-radius: 9px;
  color: #fff;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0,0,0,.35);
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
#sidebarOpenBtn:hover,
#sidebarOpenBtn:active { background: #2d3f55; }

@media (max-width: 768px) {
  /* Sidebar: drawer oculto — !important para ganar sobre cualquier regla Bootstrap */
  #sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    height: 100% !important;
    width: 0 !important;
    min-width: 0 !important;
    overflow: hidden !important;
    z-index: 1040 !important;
    box-shadow: none !important;
    transition: width .25s ease, box-shadow .25s ease !important;
  }

  /* Sidebar abierto */
  #app-wrapper.sidebar-open #sidebar {
    width: var(--sidebar-width) !important;
    min-width: var(--sidebar-width) !important;
    box-shadow: 4px 0 24px rgba(0,0,0,.4) !important;
  }

  /* Overlay visible cuando sidebar está abierto */
  #app-wrapper.sidebar-open #sidebar-overlay {
    display: block;
  }

  /* El contenido ocupa todo el ancho */
  #main-area {
    width: 100% !important;
    margin-left: 0 !important;
  }
}
