/* ==========================================================================
   OIIon Security Platform - Layout de Pantalla Completa
   ========================================================================== */

:root {
  --bg-main: #0b0f19;
  --bg-card: #161f30;
  --bg-hover: #1e293b;
  --accent-cyan: #06b6d4;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --border-color: #1e293b;
  
  --sidebar-width: 260px;
  --header-height: 64px;
  --border-radius: 12px;
}

/* Restablecer y ocupar 100% real del viewport */
html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

/* Layout Principal de 2 Columnas */
.app-wrapper {
  display: flex;
  width: 100vw;
  min-height: 100vh;
}

/* Sidebar Fijo */
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background-color: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
}

/* Area Principal (Navbar + Contenido + Footer) */
.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Evita desbordamiento de tablas/flexbox */
  background-color: var(--bg-main);
}

/* Navbar de extremo a extremo */
.app-navbar {
  height: var(--header-height);
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  width: 100%;
}

/* Contenido Principal */
.app-content {
  flex: 1;
  padding: 24px;
  width: 100%;
}

/* Footer OIIon */
.app-footer {
  padding: 16px 24px;
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Estilos de Componentes OIIon */
.card-oiion {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.form-control-oiion {
  background-color: var(--bg-main) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: 6px;
}

.form-control-oiion:focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.3) !important;
}

.btn-action {
  background-color: transparent;
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-action:hover {
  background-color: var(--accent-cyan);
  color: #000;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.5);
}

/* ==========================================================================
   OIIon Custom Toasts (Bottom Centered)
   ========================================================================== */

#oiion-toast-container {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column-reverse; /* El más reciente queda abajo */
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.oiion-toast {
  pointer-events: auto;
  min-width: 300px;
  max-width: 500px;
  padding: 12px 20px;
  border-radius: 8px;
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.oiion-toast.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Tipos de Toast con Neón */
.oiion-toast-success {
  border-color: var(--accent-green);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.25);
}
.oiion-toast-success i.toast-icon { color: var(--accent-green); }

.oiion-toast-error {
  border-color: var(--accent-red);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.25);
}
.oiion-toast-error i.toast-icon { color: var(--accent-red); }

.oiion-toast-warning {
  border-color: #f59e0b;
  box-shadow: 0 4px 15px rgba(245, 158, 11, 0.25);
}
.oiion-toast-warning i.toast-icon { color: #f59e0b; }

.oiion-toast-info {
  border-color: var(--accent-cyan);
  box-shadow: 0 4px 15px rgba(6, 182, 212, 0.25);
}
.oiion-toast-info i.toast-icon { color: var(--accent-cyan); }

/* Botón para cerrar */
.oiion-toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  transition: color 0.2s ease;
}

.oiion-toast-close:hover {
  color: var(--text-main);
}

/* ==========================================================================
   Badging & Status Indicators (Punto Parpadeante)
   ========================================================================== */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid transparent;
}

/* Estado Activo (Verde) */
.status-badge.online {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--accent-green);
  border-color: rgba(16, 185, 129, 0.3);
}

.status-badge.online i {
  color: var(--accent-green);
  animation: pulse-green 1.5s infinite;
}

/* Estado Inactivo (Rojo) */
.status-badge.offline {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--accent-red);
  border-color: rgba(239, 68, 68, 0.3);
}

.status-badge.offline i {
  color: var(--accent-red);
  animation: pulse-red 1.5s infinite;
}

/* Animaciones del parpadeo */
@keyframes pulse-green {
  0% {
    transform: scale(0.95);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.4;
  }
}

@keyframes pulse-red {
  0% {
    transform: scale(0.95);
    opacity: 0.4;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
  100% {
    transform: scale(0.95);
    opacity: 0.4;
  }
}

.card-radio-input {
    display: none;
  }
  .card-radio-btn {
    background: rgba(10, 15, 29, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #94a3b8;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  .card-radio-btn:hover {
    border-color: rgba(0, 242, 254, 0.4);
    color: #fff;
  }
  .card-radio-input:checked + .card-radio-btn {
    background: rgba(0, 242, 254, 0.15);
    border-color: #00f2fe;
    color: #00f2fe;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
    font-weight: bold;
  }


  .equipment-avatar-container {
      width: 85px;
      height: 85px;
      margin: 0 auto 12px;
      border-radius: 50%;
      background: radial-gradient(circle, rgba(0, 242, 254, 0.1) 0%, rgba(10, 15, 29, 0.7) 80%);
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      transition: all 0.3s ease;
    }

    .equipment-icon {
      font-size: 2.2rem;
    }

    .equip-status-dot {
      position: absolute;
      top: 4px;
      right: 4px;
      width: 12px;
      height: 12px;
      border-radius: 50%;
    }

    /* Estilos Radios Modal */
    .card-radio-input {
      display: none;
    }
    .card-radio-btn {
      background: rgba(10, 15, 29, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: #94a3b8;
      font-size: 0.85rem;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .card-radio-btn:hover {
      border-color: rgba(0, 242, 254, 0.4);
      color: #fff;
    }
    .card-radio-input:checked + .card-radio-btn {
      background: rgba(0, 242, 254, 0.15);
      border-color: #00f2fe;
      color: #00f2fe;
      box-shadow: 0 0 10px rgba(0, 242, 254, 0.2);
      font-weight: bold;
    }

    /* ==========================================================================
   ESTADOS DE CHAPA - OIION
   ========================================================================== */

/* Badge Abierto (Verde) */
.status-badge.abierto {
    background-color: rgba(16, 185, 129, 0.15);
    border-color: rgba(16, 185, 129, 0.4);
    color: #10b981;
}

.status-badge.abierto i {
    color: #10b981;
}

.status-badge.abierto .badge-text {
    color: #10b981;
}

/* Badge Cerrado (Rojo) */
.status-badge.cerrado {
    background-color: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
}

.status-badge.cerrado i {
    color: #ef4444;
}

.status-badge.cerrado .badge-text {
    color: #ef4444;
}

/* Badge Sin Estado (Gris) */
.status-badge.sin-estado {
    background-color: rgba(148, 163, 184, 0.1);
    border-color: rgba(148, 163, 184, 0.3);
    color: #94a3b8;
}

.status-badge.sin-estado i {
    color: #94a3b8;
}

.status-badge.sin-estado .badge-text {
    color: #94a3b8;
}

/* ============================================================
   LOGIN OIION - Estilos para página de ingreso
   ============================================================ */

/* --- Reset para página de login --- */
body.login-page {
    width: 100%;
    min-height: 100vh;
    background: #050a15 !important;
    font-family: 'Inter', sans-serif !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 20px !important;
    margin: 0 !important;
    overflow-x: hidden !important;
}

/* Contenedor principal del login */
.login-container {
    width: 380px;
    max-width: 100%;
    background: rgba(11, 15, 25, 0.95) !important;
    border-radius: 24px !important;
    box-shadow: 
        0 0 30px rgba(6, 182, 212, 0.08),
        0 20px 60px rgba(0,0,0,0.8) !important;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.06);
    backdrop-filter: blur(10px);
    margin: 0 auto !important;
}

/* Header del login (Logo + Nombre) */
.login-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 35px 0 15px 0;
    background: transparent !important;
}

.login-header img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
}

.login-header h1 {
    font-size: 26px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: 2px;
}

.login-header h1 span {
    color: var(--accent-cyan);
}

/* Formulario de ingreso */
.login-form {
    padding: 10px 30px 30px;
    background: transparent !important;
}

.login-form label {
    display: none;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 14px;
    background: rgba(255,255,255,0.04) !important;
    border: 1px solid rgba(255,255,255,0.06) !important;
    border-radius: 12px !important;
    color: #ffffff !important;
    font-size: 14px;
    font-family: 'Inter', sans-serif !important;
    transition: 0.3s;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 25px rgba(6, 182, 212, 0.06) !important;
    background: rgba(255,255,255,0.07) !important;
}

.login-form input::placeholder {
    color: rgba(255,255,255,0.2);
}

.login-form .btn-login {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, var(--accent-cyan), #0891b2) !important;
    border: none !important;
    border-radius: 12px !important;
    color: #000 !important;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-form .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(6, 182, 212, 0.3) !important;
    background: linear-gradient(135deg, #22d3ee, var(--accent-cyan)) !important;
}

/* Panel secundario (info) */
.login-footer {
    background: rgba(0,0,0,0.2) !important;
    padding: 25px 25px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.04) !important;
}

.login-footer p {
    color: rgba(255,255,255,0.4) !important;
    font-size: 13px;
    margin: 8px 0;
    background: transparent !important;
}

.login-footer p strong {
    color: #ffffff !important;
}

.login-footer a {
    color: #22d3ee !important;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
    font-size: 13px;
}

.login-footer a:hover {
    color: #ffffff !important;
    text-shadow: 0 0 20px rgba(6, 182, 212, 0.2);
}

.login-footer .tech-icons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 14px 0 10px;
    color: rgba(255,255,255,0.2) !important;
    font-size: 11px;
    background: transparent !important;
}

.login-footer .tech-icons i {
    color: var(--accent-cyan);
    margin-right: 4px;
    font-size: 12px;
}

.login-footer hr {
    border: none;
    height: 1px;
    background: rgba(255,255,255,0.04) !important;
    margin: 14px 0;
}

/* Esquina inferior derecha */
.corner-logo {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 10px;
    color: rgba(255,255,255,0.04);
    letter-spacing: 2px;
    background: transparent;
    padding: 0;
}

/* Resetear estilos de AdminLTE en login */
.login-page .wrapper,
.login-page .main-header,
.login-page .main-sidebar,
.login-page .content-wrapper,
.login-page .main-footer {
    all: unset !important;
}

/* ============================================================
   LOGIN - Validación de contraseña (OIION)
   ============================================================ */

.validation-message {
    font-size: 12px;
    margin-top: -10px;
    margin-bottom: 10px;
    padding-left: 5px;
}

.error-message {
    color: #ef4444 !important;
}

.success-message {
    color: #10b981 !important;
}

.login-form .btn-login:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ============================================================
   PÁGINA DE ÉXITO - CONTRASEÑA ACTUALIZADA (OIION)
   ============================================================ */

/* Contenedor de éxito */
.success-container {
    max-width: 480px !important;
}

.success-section {
    padding: 50px 35px;
    text-align: center;
}

/* Icono de éxito */
.success-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 30px;
    animation: pulse 0.8s ease-out;
}

.success-icon i {
    font-size: 50px;
    color: #000;
}

@keyframes pulse {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-title {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 15px;
}

.success-title span {
    color: var(--accent-cyan);
}

.success-message {
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 30px;
}

.divider {
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-cyan), transparent);
    margin: 20px auto;
    border-radius: 3px;
}

/* Botón de acceso */
.btn-login {
    background: linear-gradient(135deg, var(--accent-cyan), #0099cc);
    border: none;
    padding: 16px 32px;
    border-radius: 50px;
    color: #000;
    font-weight: 700;
    font-size: 18px;
    width: 100%;
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-decoration: none;
}

.btn-login:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(6, 182, 212, 0.3);
    color: #000;
}

.btn-login i {
    font-size: 20px;
}

/* Enlace en info panel */
.info-link {
    color: var(--accent-cyan);
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s;
}

.info-link:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 480px) {
    .success-section {
        padding: 40px 25px;
    }
    .success-title {
        font-size: 28px;
    }
    .success-icon {
        width: 80px;
        height: 80px;
    }
    .success-icon i {
        font-size: 40px;
    }
}

/* ==========================================================================
   SWITCH DENTRO DEL DROPDOWN
   ========================================================================== */

.dropdown-item-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  color: var(--text-muted);
  transition: all 0.15s ease;
  cursor: default;
}

.dropdown-item-switch:hover {
  background: rgba(240, 165, 0, 0.05);
  color: var(--text-main);
}

.dropdown-item-switch .switch-label {
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 10px;
  color: var(--text-muted);
}

.dropdown-item-switch .switch-label.active {
  color: var(--accent-green);
}

.dropdown-item-switch .switch-label.inactive {
  color: var(--accent-red);
}

.dropdown-item-switch .custom-switch {
  padding-left: 2.2rem;
  margin-bottom: 0;
}

.dropdown-item-switch .custom-control-label::before {
  width: 2rem;
  height: 1rem;
  border-radius: 1rem;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.dropdown-item-switch .custom-control-label::after {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background-color: var(--text-muted);
  top: 0.1rem;
  left: -1.8rem;
  transition: all 0.3s ease;
}

.dropdown-item-switch .custom-control-input:checked ~ .custom-control-label::before {
  background-color: var(--accent-green);
  border-color: var(--accent-green);
}

.dropdown-item-switch .custom-control-input:checked ~ .custom-control-label::after {
  background-color: #fff;
  transform: translateX(1rem);
}

.dropdown-item-switch .custom-control-input:disabled ~ .custom-control-label {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ==========================================================================
   ESTILOS PARA BUSCADOR DE GEOCERCAS
   ========================================================================== */

.search-box .form-control {
  background-color: var(--bg-main) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-main) !important;
  border-radius: 6px;
  padding: 0.375rem 0.75rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.search-box .form-control:focus {
  border-color: var(--accent-cyan) !important;
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15) !important;
}

.search-box .form-control::placeholder {
  color: var(--text-muted);
}

.search-box .btn-search {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  border-radius: 0 6px 6px 0;
  transition: all 0.2s ease;
}

.search-box .btn-search:hover {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.search-box .btn-search:active {
  background-color: var(--bg-hover);
  color: var(--accent-cyan);
}