/* =========================================================================
   CoreConnect Web - Estilo Corporativo Nube (Inspirado en CONTPAQi / Mi Gestión)
   Paleta: Azul Cobalto, Azul Marino Frío, Blanco Puro y Acentos Cian
   ========================================================================= */

:root {
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Colores Corporativos */
  --brand-blue: #005EAD;
  --brand-blue-hover: #004D8F;
  --brand-cyan: #0284C7;
  --brand-cyan-light: #0EA5E9;
  --accent-glow: rgba(2, 132, 199, 0.2);

  /* Superficies y Neutros */
  --card-bg: #FFFFFF;
  --card-border: rgba(226, 232, 240, 0.85);
  --input-bg: #F8FAFC;
  --input-border: #CBD5E1;
  --input-focus-border: #0284C7;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --text-light: #94A3B8;

  /* Estados de Error y Éxito */
  --status-success: #10B981;
  --error-bg: #7F1D1D;
  --error-border: #EF4444;
  --error-text: #FFFFFF;

  /* Elevaciones */
  --shadow-card: 0 20px 40px rgba(0, 0, 0, 0.32), 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-btn: 0 4px 14px rgba(0, 94, 173, 0.35);
  --radius-card: 16px;
  --radius-btn: 8px;
  --radius-input: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  font-family: var(--font-family);
  background-color: #0A1426;
  color: var(--text-primary);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================================================
   1. VISTA DE LOGIN Y ATMÓSFERA EMPRESARIAL
   ========================================================================= */

.login-view {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: 
    linear-gradient(135deg, rgba(15, 32, 67, 0.90) 0%, rgba(10, 20, 38, 0.95) 100%),
    url('../assets/background-people.jpg') center/cover no-repeat fixed;
  z-index: 10;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.login-view.fade-out {
  opacity: 0;
  transform: scale(0.98);
  pointer-events: none;
}

/* Marca de Agua Digital Core Solutions */
.watermark-wrapper {
  position: fixed;
  top: 28px;
  right: 36px;
  pointer-events: none;
  z-index: 2;
  user-select: none;
}

.dcs-watermark {
  width: 150px;
  height: auto;
  opacity: 0.18;
  display: block;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
  transition: opacity 0.3s ease;
}

@media (max-width: 640px) {
  .watermark-wrapper {
    top: 16px;
    right: 16px;
  }
  .dcs-watermark {
    width: 110px;
    opacity: 0.15;
  }
}

/* Contenedor y Tarjeta de Acceso */
.login-wrapper {
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 5;
  animation: cardEnter 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-card {
  width: 100%;
  background: var(--card-bg);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--card-border);
  padding: 38px 34px 32px 34px;
  position: relative;
}

/* Cabecera con Logotipo Oficial */
.brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}

.brand-logo-img {
  width: 220px;
  max-width: 240px;
  height: auto;
  max-height: 85px;
  margin: 0 auto 15px auto;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.05));
}

.brand-subtitle {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Campos de Formulario */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.input-container {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.form-input {
  width: 100%;
  height: 44px;
  padding: 10px 14px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-input);
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.form-input:hover {
  border-color: #94A3B8;
}

.form-input:focus {
  background-color: #FFFFFF;
  border-color: var(--input-focus-border);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
}

.form-input::placeholder {
  color: #94A3B8;
  font-weight: 400;
}

/* Botón Toggle Password con SVG */
.toggle-password {
  position: absolute;
  right: 12px;
  background: transparent;
  border: none;
  color: #64748B;
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.toggle-password:hover {
  color: #0F172A;
  background-color: rgba(0, 0, 0, 0.04);
}

.toggle-password:focus {
  outline: none;
  color: var(--brand-blue);
}

/* Botón de Conexión Institucional */
.btn-primary {
  width: 100%;
  height: 46px;
  background: linear-gradient(135deg, var(--brand-blue) 0%, var(--brand-cyan) 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-btn);
  font-family: var(--font-family);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
  box-shadow: var(--shadow-btn);
  transition: background 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--brand-blue-hover) 0%, #0369A1 100%);
  box-shadow: 0 6px 18px rgba(0, 94, 173, 0.42);
  transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(0, 94, 173, 0.3);
}

.btn-primary:disabled {
  opacity: 0.75;
  cursor: not-allowed;
  transform: none;
}

/* Spinner de carga */
.spinner {
  width: 17px;
  height: 17px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  border-top-color: #FFFFFF;
  animation: spin 0.8s linear infinite;
  display: none;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Banner de Errores Discreto */
.alert-box {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.45;
  display: none;
  animation: alertEnter 0.2s ease-out;
}

@keyframes alertEnter {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.alert-box.show {
  display: block;
}

.alert-error {
  background: var(--error-bg);
  border-left: 4px solid var(--error-border);
  color: var(--error-text);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.alert-info {
  background: #0C4A6E;
  border-left: 4px solid #38BDF8;
  color: #FFFFFF;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Pie de Página Institucional */
.login-footer {
  margin-top: 22px;
  font-size: 11px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.03em;
  text-align: center;
  user-select: none;
}

/* =========================================================================
   2. VISTA DE SESIÓN RDP Y LIENZO GUACAMOLE
   ========================================================================= */

.session-view {
  display: none;
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000000;
  z-index: 100;
  overflow: hidden;
}

.session-view.active {
  display: block;
}

/* Lienzo que abarca la totalidad del viewport */
.viewport-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000000;
  overflow: hidden;
  outline: none;
}

/* Barra de utilidades flotante, traslúcida y ultra-minimalista */
.floating-session-bar {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 9999px;
  padding: 5px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  user-select: none;
  opacity: 0.92;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.floating-session-bar:hover {
  opacity: 1;
  transform: translateX(-50%) translateY(1px);
}

/* Indicador Verde "En línea" */
.session-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-dot-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--status-success);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulseGreen 2s infinite;
}

@keyframes pulseGreen {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.status-text {
  font-size: 11.5px;
  font-weight: 500;
  color: #E2E8F0;
  letter-spacing: 0.02em;
}

.session-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.18);
}

.session-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-pill {
  background: rgba(255, 255, 255, 0.08);
  color: #F1F5F9;
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 11px;
  border-radius: 9999px;
  font-family: var(--font-family);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}

.btn-pill:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #FFFFFF;
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-pill-danger {
  background: rgba(220, 38, 38, 0.25);
  color: #FCA5A5;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.btn-pill-danger:hover {
  background: rgba(220, 38, 38, 0.5);
  color: #FFFFFF;
  border-color: rgba(239, 68, 68, 0.7);
}
