/* ============================================================
   LOGIN PORTAL STYLE — cliente.firstrhgroup.com
   ============================================================ */

/* --- Background split-screen --- */
body:has(input[type="password"]) {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(135deg, #193264 0%, #0F2146 100%) !important;
  font-family: 'Poppins', sans-serif;
}

/* --- Painel esquerdo branco com corte diagonal --- */
body:has(input[type="password"])::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 58%;
  height: 100%;
  background-color: #ffffff;
  clip-path: polygon(0 0, 100% 0, 93% 100%, 0 100%);
  z-index: 0;
  pointer-events: none;
}

/* --- Container principal do React --- */
body:has(input[type="password"]) #root > div {
  background: transparent !important;
  background-image: none !important;
  background-size: unset !important;
  background-position: unset !important;
  position: relative;
  z-index: 2;
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 100vw !important;
  height: 100vh !important;
  padding: 0 7vw 0 0 !important;
  margin: 0 !important;
}

/* --- Esconde os logos animados originais do React pelo nome das classes de animação --- */
body:has(input[type="password"]) .animate-fade-in,
body:has(input[type="password"]) .animate-container,
body:has(input[type="password"]) .animate-line {
  display: none !important;
}

/* --- Esconde imagem de fundo original (portal_fundo.png) --- */
body:has(input[type="password"]) #root > div > div[style*="background"] {
  background-image: none !important;
  background-color: transparent !important;
}

/* --- Esconde logo dentro do form --- */
body:has(input[type="password"]) #root > div > form img {
  display: none !important;
}

/* --- Card do formulário — igual ao portal --- */
body:has(input[type="password"]) #root > div > form {
  background-color: #edf0f5 !important;
  border-radius: 20px !important;
  box-shadow: 4px 4px 24px rgba(0,0,0,0.30) !important;
  padding: 2.5rem 2.2rem !important;
  width: clamp(320px, 28vw, 430px) !important;
  min-width: 320px;
  max-height: 90vh;
  overflow-y: auto;
  background-image: none !important;
  pointer-events: auto !important;
  color: #1a2a4a !important;
}

/* --- Modal react-modal: overlay cobre tela toda --- */
.ReactModal__Overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  background-color: rgba(0, 0, 0, 0.55) !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}

/* --- Modal react-modal: conteúdo centralizado --- */
.ReactModal__Content {
  position: relative !important;
  inset: auto !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: clamp(300px, 90vw, 440px) !important;
  max-height: 90vh !important;
  background: #ffffff !important;
  border-radius: 10px !important;
  padding: 2rem !important;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.3) !important;
  border: none !important;
  overflow-y: auto !important;
  outline: none !important;
}

/* --- Labels --- */
body:has(input[type="password"]) label {
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.08em !important;
  color: #1a2a4a !important;
  text-transform: uppercase !important;
  margin-bottom: 6px !important;
  display: block;
}

/* --- Inputs --- */
body:has(input[type="password"]) input[type="email"],
body:has(input[type="password"]) input[type="password"],
body:has(input[type="password"]) input[type="text"] {
  background-color: #ffffff !important;
  border: 1.5px solid #d8dde6 !important;
  border-radius: 8px !important;
  padding: 0.75rem 1rem !important;
  font-size: 1rem !important;
  color: #1a2a4a !important;
  width: 100% !important;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.2s;
  pointer-events: auto !important;
}

body:has(input[type="password"]) input[type="email"]:focus,
body:has(input[type="password"]) input[type="password"]:focus {
  border-color: hsl(222deg 48% 40%) !important;
  box-shadow: 0 0 0 3px hsla(222deg 48% 50% / 0.15) !important;
}

/* --- Checkbox --- */
body:has(input[type="password"]) input[type="checkbox"] {
  width: auto !important;
  margin-right: 6px;
  pointer-events: auto !important;
}

/* --- Botão ENTRAR --- */
body:has(input[type="password"]) #root > div > form button:first-of-type {
  background-color: #1a56db !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 0.85rem 1.5rem !important;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.12em !important;
  text-transform: uppercase !important;
  width: 100% !important;
  cursor: pointer !important;
  transition: background-color 0.2s !important;
  margin-bottom: 0.75rem;
  margin-top: 0.5rem;
  pointer-events: auto !important;
}

body:has(input[type="password"]) #root > div > form button:first-of-type:hover {
  background-color: #1648c0 !important;
}

/* --- Botão Recuperar acesso — estilo portal: fundo claro, borda, texto pequeno --- */
body:has(input[type="password"]) #root > div > form button:not(:first-of-type) {
  background-color: #edf0f5 !important;
  color: #6b7280 !important;
  border: 1.5px solid #d0d5dd !important;
  border-radius: 8px !important;
  padding: 0.65rem 1.5rem !important;
  font-size: 0.8rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
  text-transform: none !important;
  width: 100% !important;
  cursor: pointer !important;
  transition: background-color 0.2s !important;
  pointer-events: auto !important;
}

body:has(input[type="password"]) #root > div > form button:not(:first-of-type):hover {
  background-color: #dde1e9 !important;
}

/* --- Links dentro do form --- */
body:has(input[type="password"]) #root > div > form a {
  color: #4b6cb7 !important;
  font-size: 0.85rem !important;
  text-decoration: none !important;
  display: block;
  text-align: center;
  margin-top: 0.5rem;
  pointer-events: auto !important;
  cursor: pointer !important;
}

body:has(input[type="password"]) #root > div > form a:hover {
  text-decoration: underline !important;
}

/* --- Elementos clicáveis dentro do form --- */
body:has(input[type="password"]) #root > div > form * {
  pointer-events: auto !important;
}

/* --- Mensagem de erro --- */
body:has(input[type="password"]) .text-red-500 {
  color: #c53030 !important;
  font-size: 0.8rem !important;
  margin-top: 0.5rem !important;
}

/* --- Esconde logos animados originais e "Desenvolvido por" --- */
body:has(input[type="password"]) .animate-container {
  display: none !important;
}
body:has(input[type="password"]) #root > div > div:not([class*="fixed"]):not([class*="inset"]) {
  display: none !important;
}

/* --- Modal overlay (Tailwind fixed inset-0): garante z-index alto em qualquer tela --- */
body:has(input[type="password"]) #root > div > div[class*="fixed"][class*="inset"] {
  z-index: 9999 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
}

/* --- Rodapé injetado --- */
.portal-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #ffffff;
  color: #64748b;
  font-size: 0.85rem;
  text-align: center;
  padding: 1.5rem;
  z-index: 10;
  font-family: 'Poppins', sans-serif;
  pointer-events: auto;
  border-top: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.portal-footer a {
  color: #64748b !important;
  text-decoration: none !important;
  display: inline !important;
  margin-top: 0 !important;
  pointer-events: auto !important;
  transition: color 0.3s;
}

.portal-footer a:hover {
  color: #2563eb !important;
}

/* --- Painel esquerdo injetado --- */
.portal-left-panel {
  position: fixed;
  top: 50%;
  left: 26%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  pointer-events: none;
  width: 420px;
}

.portal-left-panel img.portal-logo {
  max-width: 250px;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
  transition: transform 0.3s ease;
  pointer-events: auto;
}

.portal-left-panel img.portal-logo:hover {
  transform: scale(1.05);
}

.portal-brands-card {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 20px;
  padding: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 100%;
  box-sizing: border-box;
}

.portal-brands-card img {
  max-width: 80px;
  max-height: 40px;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0.8;
  transition: all 0.3s ease;
  pointer-events: auto;
}

.portal-brands-card img.img-connecting {
  max-width: 140px !important;
}

.portal-brands-card img:hover {
  opacity: 1;
  transform: translateY(-5px);
}

.portal-title {
  font-size: 2.8rem;
  font-weight: 800;
  color: hsl(222deg 48% 22%);
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.15;
  font-family: 'Poppins', sans-serif;
  text-transform: uppercase;
}

/* --- Responsivo --- */
@media (max-width: 900px) {
  body:has(input[type="password"])::before {
    display: none;
  }

  body:has(input[type="password"]) #root > div {
    justify-content: center !important;
    padding: 1rem !important;
  }

  .portal-left-panel {
    display: none;
  }
}
