:root {
  --primary-color: #ff0000;
  --secondary-color: #cc0000;
  --success-color: #00cc00;
  --danger-color: #ff0000;
  --warning-color: #ff9900;
  --background-color: #ffffff;
  --card-color: #f5f5f5;
  --text-color: #000000;
  --text-light: #555555;
  --border-color: #dddddd;
  --chart-grid-color: #cccccc;
  --highlight-color: #ff3333;
  --input-bg: #ffffff;
  --input-border: #cccccc;
  --input-focus: #ff3333;
  --button-hover: #cc0000;
  --select-hover: #f0f0f0;
}

/* Estilos para el logo en la página de login */
.logo-container {
  text-align: center;
  margin-bottom: 40px;
}

.login-logo {
  max-width: 220px;
  height: auto;
  margin: 0 auto;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Estilos para el logo en el header */
.header-logo {
  height: 82px;
  width: auto;
  margin-right: 12px;
  transform: translate(10%, -84px);
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
  object-fit: contain;
}

.header-text {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Mejorando tipografía con fuente más profesional */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Container con mejor max-width y padding responsivo */
.container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 40px;
}

/* Header más profesional con mejor jerarquía visual */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 35px;
  padding-bottom: 0;
  border-bottom: none;
  transition: all 0.3s ease;
  position: relative;
}
header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  background-color: var(--primary-color);
  bottom: 50px;
}

.header-left {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.header-title {
  margin: 0;
  font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #334155 !important;
  text-shadow: 0 0 2px rgba(51, 65, 85, 0.8), 0 2px 6px rgba(51, 65, 85, 0.3) !important;
  text-transform: uppercase;
  font-size: 21px;
  text-align: center;
  white-space: nowrap;
  margin-bottom: 8px;
  flex: 1 0 100%;
}

.header-right {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-time {
  text-align: left;
  line-height: 1.4;
}

.header-right .date-time {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 100%;
}

.date {
  font-size: 14px;
  color: #000000;
  font-weight: 700;
}

.time {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
}

.user-info {
  font-size: 14px;
  color: var(--text-light);
}

/* Títulos con mejor jerarquía y peso */
h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-color);
  letter-spacing: -0.5px;
}

h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--text-color);
  letter-spacing: -0.3px;
}

.highlight {
  color: var(--highlight-color);
  font-weight: bold;
}

/* Botones más profesionales con mejor feedback visual */
.logout-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 8px rgba(255, 0, 0, 0.25);
  letter-spacing: 0.3px;
}

.logout-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(255, 0, 0, 0.35);
}

.logout-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(255, 0, 0, 0.3);
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

/* Cards más profesionales con mejor elevación (alineado con Bootstrap) */
.card {
  background-color: var(--card-color);
  border-radius: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  padding: 0; /* dejar padding al card-body para compatibilidad Bootstrap */
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-4px);
  border-color: rgba(255, 0, 0, 0.2);
}

.card-full {
  grid-column: span 3;
}

.card-half {
  grid-column: span 2;
}

.client-info-header,
.metrics-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

/* Estilos para los indicadores de estado */
.status-indicator {
  display: flex;
  align-items: center;
  font-size: 14px;
  font-weight: 500;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 8px;
  animation: pulse 1s infinite;
}

.green-dot {
  background-color: #00cc00;
}

.red-dot {
  background-color: #ff0000;
  animation: pulse 0.5s infinite;
}

.data-available {
  color: #00cc00;
}

.no-data {
  color: #ff0000;
}

@keyframes pulse {
  0% {
    opacity: 0.4;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.4;
  }
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 15px;
  margin-top: 15px;
}

/* Metric cards más profesionales con mejor interacción */
.metric-card {
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.03) 0%, rgba(255, 0, 0, 0.08) 100%);
  border: 2px solid var(--primary-color);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.5s;
}

.metric-card:hover::before {
  left: 100%;
}

.metric-card:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 12px 28px rgba(255, 0, 0, 0.3);
  background: linear-gradient(135deg, rgba(255, 0, 0, 0.08) 0%, rgba(255, 0, 0, 0.12) 100%);
  border-width: 3px;
}

.metric-title {
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 14px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.metric-value {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--primary-color);
  letter-spacing: -1px;
  text-shadow: 0 2px 4px rgba(255, 0, 0, 0.1);
}

/* Contenedores de gráficos más profesionales */
.chart-container {
  height: 320px;
  margin-top: 20px;
  background-color: rgba(0, 0, 0, 0.01);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 15px;
}

/* Info items más profesionales con mejor espaciado */
.info-item {
  display: flex;
  margin-bottom: 14px;
  padding: 16px 18px;
  background-color: rgba(255, 0, 0, 0.03);
  border-radius: 10px;
  align-items: center;
  transition: all 0.25s ease;
  border: 1px solid transparent;
}

.info-item:hover {
  background-color: rgba(255, 0, 0, 0.08);
  border-color: rgba(255, 0, 0, 0.25);
  transform: translateX(4px);
}

.info-label {
  font-weight: 700;
  min-width: 150px;
  color: var(--primary-color);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.info-value {
  color: var(--text-light);
  flex: 1;
  font-size: 14px;
  line-height: 1.6;
  font-weight: 500;
}

.info-value.highlight {
  color: var(--highlight-color);
  font-weight: bold;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  background-color: var(--background-color);
}

/* Login box más profesional con mejor elevación */
.login-box {
  background-color: var(--card-color);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(255, 0, 0, 0.15);
  padding: 40px;
  width: 100%;
  max-width: 420px;
  border: 2px solid var(--primary-color);
}

.login-box h1 {
  text-align: center;
  margin-bottom: 30px;
  color: var(--primary-color);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  color: var(--text-color);
}

/* Inputs más profesionales con mejor UX */
.form-group input {
  width: 100%;
  padding: 14px 18px;
  background-color: var(--input-bg);
  border: 2px solid var(--input-border);
  border-radius: 8px;
  font-size: 15px;
  color: var(--text-color);
  transition: all 0.3s ease;
  font-weight: 500;
}

.form-group input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 4px rgba(255, 0, 0, 0.12);
  transform: translateY(-2px);
}

.login-btn {
  width: 100%;
  padding: 16px;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
  letter-spacing: 0.5px;
}

.login-btn:hover {
  background-color: var(--secondary-color);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(255, 0, 0, 0.4);
}

.login-btn:active {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 0, 0, 0.35);
}

.error-message {
  color: var(--danger-color);
  margin-bottom: 15px;
  text-align: center;
}

/* Mejorando animación de actualización de valores */
@keyframes valueUpdate {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0.7);
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 0, 0, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(255, 0, 0, 0);
  }
}

.metric-value.updated {
  animation: valueUpdate 0.6s ease-out;
}

/* Agregando loading state para mejor UX */
.loading {
  position: relative;
  pointer-events: none;
  opacity: 0.6;
}

.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid var(--primary-color);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Mejorando responsive design con mejores breakpoints */
@media (max-width: 1200px) {
  .container {
    padding: 25px 30px;
  }

  .metrics-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 1024px) {
  .dashboard {
    grid-template-columns: 1fr;
  }

  .card-full,
  .card-half {
    grid-column: span 1;
  }

  .metrics-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .container {
    padding: 20px 25px;
  }
}

@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .info-grid {
    grid-template-columns: 1fr;
  }

  .header-right {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
    width: 100%;
  }
  .header-right .logout-btn {
    width: 100%;
  }

  .header-logo {
    height: 29px;
    transform: none;
    margin-right: 12px;
  }
  .topdrive-active .header-logo {
    height: 23px;
  }

  .date-time-top {
    top: auto !important;
    right: 0 !important;
    bottom: 55px !important;
    z-index: 2;
  }

  .container {
    padding: 20px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 20px;
  }
  .header-title { font-size: 4px; }
}

@media (max-width: 480px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .header-left {
    flex-direction: row;
    align-items: center;
    margin-bottom: 12px;
    min-height: 0;
  }

  .header-title {
    margin-right: 0;
    margin-bottom: 5px;
  }

  header {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-right {
    width: 100%;
    margin-top: 12px;
    align-items: stretch;
    gap: 8px;
  }
  .date-time-top {
    top: auto !important;
    right: 0 !important;
    bottom: 25px !important;
    z-index: 2;
  }
  .nav-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  .header-right .logout-btn {
    width: 100%;
    height: 32px;
    padding: 6px 10px;
    font-size: 0.75rem;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

.header-logo {
  height: 42px;
  transform: none;
  width: auto;
  margin-right: 12px;
  display: block;
}

@media (max-width: 440px) {
  .metrics-grid { gap: 10px; }
  .metric-card { padding: 12px; min-height: 96px; }
  .metric-title { font-size: 11px; height: 32px; }
  .metric-value { font-size: 24px; }
  .card { border-radius: 12px; }
}
  .topdrive-active .header-logo {
    height: 34px;
  }

  .login-logo {
    max-width: 160px;
  }

  .login-box {
    padding: 30px 25px;
  }

  .container {
    padding: 15px;
  }
  .header-title { font-size: 12px; }
}

.no-data-alert {
  background-color: rgba(255, 0, 0, 0.1);
  border: 1px solid var(--danger-color);
  color: var(--danger-color);
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  font-size: 18px;
  margin: 20px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.no-data-alert i {
  font-size: 24px;
}

.hidden-metric {
  display: none !important;
}


/* Tema blanco con fuente negra */
body { background-color: #ffffff; color: #111111; }
header, .card, .filters-bar { background-color: #ffffff; color: inherit; }
label, h1, h2, h3, h4, h5, h6, p, table, .client-info-header, .legend-item { color: #111111; }
.apply-btn { background: #007bff; color: #ffffff; }

/* Ajustes para Select2 */
.select2-container .select2-selection--single { height: 36px; }
.select2-container .select2-selection--multiple { min-height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 36px; }
.select2-container--default .select2-selection--single .select2-selection__placeholder { color: #666666; }
.select2-container--default .select2-selection--single { border-color: #cccccc; }
.select2-container--default .select2-selection--multiple { border-color: #cccccc; }

/* Inputs y tablas en modo claro */
select, input, textarea { color: #111111; background-color: #ffffff; border-color: #cccccc; }
.table, table { color: #111111; }


/* Botón rojo personalizado (#EB0909) */
.btn-red {
  background-color: #EB0909 !important;
  border-color: #EB0909 !important;
  color: #ffffff !important;
}

.btn-red:hover,
.btn-red:focus {
  background-color: #d30808 !important; /* ~10% más oscuro */
  border-color: #d30808 !important;
  color: #ffffff !important;
}

.btn-red:active {
  background-color: #b30707 !important; /* presionado */
  border-color: #b30707 !important;
  color: #ffffff !important;
}


.nav-buttons {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  margin: 8px 0 10px;
  flex: 1 0 100%;
}

/* Menú desplegable centrado con icono */
.menu-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  margin: 6px 0 10px;
}
.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.menu-emoji { font-size: 20px; line-height: 1; }
.menu-label { font-weight: 700; letter-spacing: 0.2px; }
.menu-toggle .menu-label { display: none; opacity: 0; transition: opacity 0.2s ease; }
.menu-toggle:hover .menu-label,
.menu-toggle:focus .menu-label { display: inline; opacity: 1; }
.menu-dropdown {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  flex-direction: row;
  gap: 12px;
  padding: 12px;
  background: var(--card-color);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  z-index: 10;
}
.menu-wrapper.open .menu-dropdown { display: flex; }
.menu-dropdown .logout-btn { justify-content: center; text-align: center; }
@media (max-width: 768px) {
  .menu-dropdown { flex-direction: column; align-items: stretch; width: 90%; }
  .menu-dropdown .logout-btn { width: 100%; }
}


.date-time-top {
  position: absolute;
  right: 0;
  top: 40px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* Ajuste específico para vistas con 2 columnas en el dashboard */
.two-cols-active .date-time-top {
  top: auto !important;
  right: 0 !important;
  bottom: 80px !important;
}


.user-info-center {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 6px 0 4px;
}
.user-info { font-size: 13px; line-height: 1.4; letter-spacing: 0.2px; }
/* revert spaced margins for user info to default */
.welcome-label { font-weight: 700; color: #000000; font-size: 13px; line-height: 1.4; letter-spacing: 0.2px; font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important; text-transform: uppercase; }
.welcome-user { color: var(--primary-color); font-weight: 600; font-size: 13px; line-height: 1.4; letter-spacing: 0.2px; font-family: 'Orbitron', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important; text-transform: uppercase; }


.two-cols-active .header-logo {
  height: 51px;
}

.topdrive-active .header-logo {
  height: 143px;
}
@media (max-width: 440px) {
  .topdrive-active .header-logo { height: 86px !important; transform: translate(0, -30px); }
  .header-logo { height: 49px !important; transform: translate(0, -20px); }
}
@media (max-width: 440px) and (orientation: portrait) {
  .header-title { display: inline-block; transform: translateX(47px) !important; }
}


