/* Variables del Sistema de Diseño (INC Global) */
:root {
  --inc-primary: #003366;       /* Azul Marino Institucional */
  --inc-secondary: #C8102E;     /* Rojo Bandera */
  --inc-bg: #F4F7F6;            /* Gris Ultra Claro */
  --inc-text: #2C3E50;          /* Texto principal */
  --inc-light: #FFFFFF;         /* Superficie blanca */
  --inc-shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --inc-shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --border-radius-inc: 4px;     /* Bordes redondeados sutiles */
}

/* Estilos Globales */
body {
  font-family: 'Roboto', 'Open Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background-color: var(--inc-bg);
  color: var(--inc-text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main.app-bg {
  flex: 1;
}

/* Clases de Utilidad */
.border-radius-4 {
  border-radius: var(--border-radius-inc) !important;
}

.border-radius-start {
  border-top-left-radius: var(--border-radius-inc) !important;
  border-bottom-left-radius: var(--border-radius-inc) !important;
}

.border-radius-end {
  border-top-right-radius: var(--border-radius-inc) !important;
  border-bottom-right-radius: var(--border-radius-inc) !important;
}

.max-width-600 {
  max-width: 600px;
  margin: 0 auto;
}

.max-height-400 {
  max-height: 400px;
  overflow-y: auto;
}

.fs-7 {
  font-size: 0.85rem;
}

.fs-8 {
  font-size: 0.75rem;
}

.text-primary-inc {
  color: var(--inc-primary) !important;
}

/* Cabecera */
.app-header {
  background: linear-gradient(135deg, var(--inc-primary) 0%, #002244 100%);
  border-bottom: 3px solid var(--inc-secondary);
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.header-subtitle {
  font-size: 0.9rem;
}

/* Tarjetas */
.card-custom {
  border-radius: var(--border-radius-inc);
  background-color: var(--inc-light);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-header {
  border-top-left-radius: var(--border-radius-inc) !important;
  border-top-right-radius: var(--border-radius-inc) !important;
}

/* Botones de Pánico (Premium & Micro-animaciones) */
.btn-panic {
  border: none;
  color: #fff;
  font-size: 0.95rem;
  letter-spacing: 0.5px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.btn-panic::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300%;
  height: 300%;
  background: rgba(255, 255, 255, 0.15);
  transform: translate(-50%, -50%) scale(0);
  border-radius: 50%;
  transition: transform 0.5s ease;
}

.btn-panic:active::after {
  transform: translate(-50%, -50%) scale(1);
  transition: transform 0s;
}

.btn-panic:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 15px rgba(0, 0, 0, 0.15);
}

.btn-panic:active {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Variaciones del botón de pánico */
.btn-panic-fire {
  background: linear-gradient(135deg, #e65c00 0%, #F92C2C 100%);
  border-bottom: 4px solid #b30000;
}
.btn-panic-fire:hover {
  background: linear-gradient(135deg, #ff6a00 0%, #ff3b3b 100%);
}

.btn-panic-flood {
  background: linear-gradient(135deg, #0052D4 0%, #4364F7 50%, #6FB1FC 100%);
  border-bottom: 4px solid #003399;
}
.btn-panic-flood:hover {
  background: linear-gradient(135deg, #0066ff 0%, #5275ff 100%);
}

.btn-panic-earthquake {
  background: linear-gradient(135deg, #870000 0%, #190A05 100%);
  border-bottom: 4px solid #4a0000;
}
.btn-panic-earthquake:hover {
  background: linear-gradient(135deg, #a30000 0%, #2b1109 100%);
}

.btn-panic-agent {
  background: linear-gradient(135deg, #373B44 0%, #4286f4 100%);
  border-bottom: 4px solid #23272e;
}
.btn-panic-agent:hover {
  background: linear-gradient(135deg, #4b515d 0%, #5593f5 100%);
}

/* Tarjetas de Pisos (Censo) */
.floor-card {
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-left: 5px solid var(--inc-primary);
  border-radius: var(--border-radius-inc);
  background-color: var(--inc-light);
  transition: all 0.2s ease;
}

.floor-card:hover {
  box-shadow: var(--inc-shadow-md);
  border-left-width: 8px;
}

.floor-card.emergency-floor {
  border-left-color: var(--inc-secondary);
  animation: border-flash 1.5s infinite alternate;
}

.floor-badge-count {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.2rem;
  background-color: var(--inc-bg);
  color: var(--inc-primary);
  border: 2px solid var(--inc-primary);
}

.floor-card.emergency-floor .floor-badge-count {
  background-color: #ffe6e6;
  color: var(--inc-secondary);
  border-color: var(--inc-secondary);
}

/* Tablas */
.table-dark-inc {
  background-color: var(--inc-primary);
  color: #ffffff;
}

.table-dark-inc th {
  background-color: var(--inc-primary) !important;
  color: #ffffff !important;
  font-weight: 500;
  font-size: 0.9rem;
  border-bottom: 2px solid var(--inc-secondary);
}

.table tbody tr {
  transition: background-color 0.15s ease;
}

.table-hover tbody tr:hover {
  background-color: rgba(0, 51, 102, 0.04) !important;
  cursor: pointer;
}

/* Superposición de Emergencia (Pantalla Completa) */
.emergency-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(200, 16, 46, 0.96); /* Rojo Bandera Institucional con 96% opacidad */
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: overlay-flash 2s infinite alternate;
  overflow-y: auto;
}

.overlay-content {
  width: 100%;
  max-width: 800px;
  color: #ffffff;
}

.alarm-icon-container {
  font-size: 6rem;
}

.alarm-pulse-icon {
  animation: icon-bounce 1s infinite alternate;
  display: inline-block;
}

.overlay-title {
  font-size: 3.5rem;
  font-weight: 900;
  letter-spacing: 2px;
}

.overlay-subtitle {
  font-size: 2rem;
  font-weight: 400;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* Animaciones */
@keyframes overlay-flash {
  0% {
    background-color: rgba(200, 16, 46, 0.96);
  }
  100% {
    background-color: rgba(100, 5, 20, 0.98);
  }
}

@keyframes border-flash {
  0% {
    border-left-color: var(--inc-secondary);
  }
  100% {
    border-left-color: #ff8080;
  }
}

@keyframes icon-bounce {
  0% {
    transform: scale(0.9) rotate(-3deg);
  }
  100% {
    transform: scale(1.1) rotate(3deg);
  }
}

@keyframes alert-pulsing-text {
  0% {
    opacity: 0.9;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
  }
  100% {
    opacity: 1;
    text-shadow: 0 0 25px rgba(255, 255, 255, 0.9), 0 0 10px rgba(255, 255, 255, 0.5);
  }
}

.alert-pulsing-text {
  animation: alert-pulsing-text 1s infinite alternate;
}

/* Badge de Estado */
.status-txt {
  font-weight: bold;
}

/* Responsividad en Dispositivos Móviles */
@media (max-width: 768px) {
  .overlay-title {
    font-size: 2.2rem;
  }
  .overlay-subtitle {
    font-size: 1.4rem;
  }
  .btn-panic {
    padding: 1.5rem 0.5rem !important;
    font-size: 0.8rem;
  }
  .btn-panic i {
    font-size: 2rem !important;
  }
  .floor-badge-count {
    width: 38px;
    height: 38px;
    font-size: 1rem;
  }
  .table-responsive {
    max-height: 300px;
  }
}
