/* ===================================================
   SIIC Auditorías en Planta - CIPLAS S.A.S.
   Estilos Corporativos - Inspirado en login.jpg y plataforma.jpg
   =================================================== */

:root {
  --bg-dark-sidebar: #0a1128;
  --bg-dark-sidebar-hover: #162447;
  --bg-dark-card: #111c38;
  --bg-page: #f1f5f9;
  --bg-card: #ffffff;
  --text-dark-primary: #0f172a;
  --text-dark-secondary: #64748b;
  --text-light-primary: #ffffff;
  --text-light-secondary: #94a3b8;
  
  --primary-blue: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-accent: #2563eb;
  --accent-cyan: #06b6d4;
  --accent-glow: rgba(37, 99, 235, 0.35);

  --color-rojo: #ef4444;
  --color-rojo-bg: #fee2e2;
  --color-amarillo: #eab308;
  --color-amarillo-bg: #fef9c3;
  --color-verde: #10b981;
  --color-verde-bg: #d1fae5;
  --color-azul: #0ea5e9;
  --color-azul-bg: #e0f2fe;

  --status-excelente: #10b981;
  --status-aceptable: #3b82f6;
  --status-mejora: #f59e0b;
  --status-critico: #ef4444;

  --border-subtle: #e2e8f0;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
  --shadow-hover: 0 10px 25px -3px rgba(37, 99, 235, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
}

body {
  background-color: var(--bg-page);
  color: var(--text-dark-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* ================= APP LAYOUT ================= */
.app-container {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar estilo plataforma.jpg */
.sidebar {
  width: 260px;
  background-color: var(--bg-dark-sidebar);
  color: var(--text-light-primary);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
  transition: all 0.3s ease;
}

.sidebar-brand {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: white;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.brand-icon svg {
  width: 22px;
  height: 22px;
  fill: white;
}

.brand-text h2 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1.1;
}

.brand-text span {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-cyan);
  font-weight: 600;
}

.sidebar-toggle {
  background: transparent;
  border: none;
  color: var(--text-light-secondary);
  font-size: 1.2rem;
  cursor: pointer;
}

.sidebar-nav {
  padding: 16px 12px;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  padding: 12px 14px 4px;
  font-weight: 700;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all 0.2s ease;
  position: relative;
}

.nav-item:hover {
  background-color: var(--bg-dark-sidebar-hover);
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, 0.25), rgba(37, 99, 235, 0.05));
  color: #ffffff;
  border-left: 3px solid var(--accent-cyan);
}

.nav-item i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.nav-badge {
  margin-left: auto;
  background-color: #ef4444;
  color: white;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.nav-badge.online {
  background-color: #10b981;
}

/* User pill bottom sidebar */
.sidebar-user {
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  overflow: hidden;
}

.user-avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: white;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.user-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: white;
}

.user-role {
  font-size: 0.72rem;
  color: #94a3b8;
}

.logout-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.1rem;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.2s;
}

.logout-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  height: 100vh;
}

/* Header */
.top-header {
  background: #ffffff;
  padding: 14px 28px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 4px rgba(0,0,0,0.03);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-badge {
  background-color: #f1f5f9;
  border: 1px solid var(--border-subtle);
  color: #1e293b;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-badge i {
  color: var(--primary-blue);
}

.shift-status-pill {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.color-dot.Amarillo { background-color: #eab308; box-shadow: 0 0 8px rgba(234, 179, 8, 0.5); }
.color-dot.Verde { background-color: #10b981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
.color-dot.Rojo { background-color: #ef4444; box-shadow: 0 0 8px rgba(239, 68, 68, 0.5); }
.color-dot.Azul { background-color: #0ea5e9; box-shadow: 0 0 8px rgba(14, 165, 233, 0.5); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-primary {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.3);
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #1e40af, #1d4ed8);
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(37, 99, 235, 0.4);
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid var(--border-subtle);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

/* Page Body */
.page-body {
  padding: 28px;
  flex-grow: 1;
}

/* ================= KPI CARDS ================= */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  padding: 20px 22px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.kpi-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-dark-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-dark-primary);
  line-height: 1.1;
}

.kpi-subtext {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 4px;
}

.kpi-icon-box {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.icon-blue { background: #eff6ff; color: #2563eb; }
.icon-green { background: #ecfdf5; color: #10b981; }
.icon-amber { background: #fffbeb; color: #f59e0b; }
.icon-red { background: #fef2f2; color: #ef4444; }

/* ================= CARDS & CONTAINERS ================= */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  padding: 22px;
  margin-bottom: 24px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ================= FILTERS BAR ================= */
.filter-bar {
  background: white;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.search-input-wrapper {
  position: relative;
  flex: 1 1 240px;
}

.search-input-wrapper i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
}

.search-input-wrapper input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
  border-color: var(--primary-accent);
}

.filter-select {
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  color: #334155;
  background: white;
  outline: none;
  cursor: pointer;
  min-width: 160px;
}

/* ================= DATA TABLES ================= */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.custom-table th {
  background: #f8fafc;
  color: #64748b;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--border-subtle);
}

.custom-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: #334155;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background-color: #f8fafc;
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-rojo { background-color: var(--color-rojo-bg); color: var(--color-rojo); border: 1px solid #fca5a5; }
.badge-amarillo { background-color: var(--color-amarillo-bg); color: #854d0e; border: 1px solid #fde047; }
.badge-verde { background-color: var(--color-verde-bg); color: #065f46; border: 1px solid #86efac; }
.badge-azul { background-color: var(--color-azul-bg); color: #0369a1; border: 1px solid #7dd3fc; }
.badge-fijo { background-color: #f1f5f9; color: #475569; border: 1px solid #cbd5e1; }

.badge-excelente { background-color: #d1fae5; color: #065f46; }
.badge-aceptable { background-color: #e0f2fe; color: #0369a1; }
.badge-mejora { background-color: #fef3c7; color: #92400e; }
.badge-critico { background-color: #fee2e2; color: #991b1b; }
.badge-pendiente { background-color: #f3f4f6; color: #4b5563; }

/* Progress bar inside table */
.progress-bar-container {
  width: 100%;
  max-width: 110px;
  background-color: #e2e8f0;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* ================= 4 PARAMETERS SUMMARY ================= */
.params-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.param-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 18px;
  border: 1px solid var(--border-subtle);
  border-top: 4px solid var(--primary-blue);
  box-shadow: var(--shadow-card);
}

.param-card.param-capacitacion { border-top-color: #3b82f6; }
.param-card.param-proceso { border-top-color: #10b981; }
.param-card.param-bpf { border-top-color: #f59e0b; }
.param-card.param-calidad { border-top-color: #ec4899; }

.param-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.param-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: #1e293b;
}

.param-weight-pill {
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #475569;
}

.param-score {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
}

/* ================= MODAL ================= */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-backdrop.active {
  display: flex;
}

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 650px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.25);
  overflow: hidden;
  animation: modalFadeIn 0.25s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 18px 24px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.3rem;
  color: #64748b;
  cursor: pointer;
}

.modal-body {
  padding: 24px;
  max-height: 75vh;
  overflow-y: auto;
}

.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-control:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: -260px;
  }
  .sidebar.mobile-open {
    left: 0;
  }
  .top-header {
    padding: 12px 16px;
  }
  .page-body {
    padding: 16px;
  }
}
