/* ==========================================================================
   iSol DevStation · Design Cinematográfico & Glassmorphism Soberano
   4Clouders - Interface de Autenticação de Alta Fidelidade
   ========================================================================== */

:root {
  --bg-dark: #060913;
  --bg-card: rgba(11, 17, 34, 0.78);
  --bg-input: rgba(15, 23, 42, 0.75);
  --border-neon: rgba(168, 85, 247, 0.45);
  --border-card: rgba(168, 85, 247, 0.32);
  --border-input: rgba(148, 163, 184, 0.28);
  --border-focus: #38bdf8;
  --focus-glow: rgba(56, 189, 248, 0.4);
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --accent-cyan: #38bdf8;
  --accent-indigo: #818cf8;
  --accent-purple: #a855f7;
  --accent-purple-light: #c084fc;
  --btn-gradient: linear-gradient(135deg, #2563eb 0%, #6366f1 50%, #9333ea 100%);
  --btn-hover: linear-gradient(135deg, #1d4ed8 0%, #4f46e5 50%, #7e22ce 100%);
  --error-bg: rgba(239, 68, 68, 0.16);
  --error-border: rgba(239, 68, 68, 0.4);
  --error-text: #fca5a5;
  --radius-card: 26px;
  --radius-input: 12px;
  --radius-pill: 9999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

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

[hidden] {
  display: none !important;
}

html, body {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  background-color: var(--bg-dark);
  color: var(--text-primary);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Camada de Vídeo de Fundo e Efeitos Cinematográficos
   ========================================================================== */

.cinema-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(36px) saturate(220%) brightness(0.55);
  transform: scale(1.15);
  opacity: 0.9;
  will-change: transform;
}

.backdrop-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(15, 23, 42, 0.15) 0%, rgba(6, 9, 19, 0.8) 100%);
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 35%, rgba(0, 0, 0, 0.88) 100%);
}

.film-grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: overlay;
}

/* ==========================================================================
   Layout Principal e Palco Cinematográfico
   ========================================================================== */

.page-container {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(32px, 4.5vw, 64px);
  padding: 32px 36px;
}

/* Palco Visual (Desktop: Vídeo em Grande Destaque) */
.stage-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
}

.stage-frame {
  position: relative;
  width: clamp(480px, 42vw, 660px);
  height: min(84vh, 840px);
  aspect-ratio: 896 / 1120;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--border-neon);
  box-shadow: 0 35px 85px rgba(0, 0, 0, 0.9), 0 0 45px rgba(168, 85, 247, 0.35), 0 0 80px rgba(56, 189, 248, 0.2);
  background: #080c18;
  animation: stage-breathe 6s ease-in-out infinite alternate;
  will-change: transform, box-shadow;
}

.main-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.poster-fallback {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.stage-glow {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-card);
  box-shadow: inset 0 0 35px rgba(168, 85, 247, 0.25), inset 0 0 60px rgba(56, 189, 248, 0.15);
  pointer-events: none;
}

.stage-ambient-light {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, transparent 40%, rgba(0, 0, 0, 0.3) 100%);
  pointer-events: none;
}

@keyframes stage-breathe {
  0% {
    border-color: rgba(168, 85, 247, 0.35);
    box-shadow: 0 35px 85px rgba(0, 0, 0, 0.9), 0 0 35px rgba(168, 85, 247, 0.25), 0 0 60px rgba(56, 189, 248, 0.15);
  }
  100% {
    border-color: rgba(168, 85, 247, 0.65);
    box-shadow: 0 35px 85px rgba(0, 0, 0, 0.9), 0 0 60px rgba(168, 85, 247, 0.5), 0 0 100px rgba(56, 189, 248, 0.3);
  }
}

/* ==========================================================================
   Painel de Autenticação (Glassmorphism com Logo Oficial iSol)
   ========================================================================== */

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 min(440px, 36vw);
  width: 100%;
}

.glass-card {
  width: 100%;
  padding: 42px 38px;
  background: var(--bg-card);
  backdrop-filter: blur(32px) saturate(210%);
  -webkit-backdrop-filter: blur(32px) saturate(210%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-card);
  box-shadow: 0 35px 80px -10px rgba(0, 0, 0, 0.85), 0 0 45px rgba(168, 85, 247, 0.22);
  animation: card-appear 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
  will-change: transform;
}

@keyframes card-appear {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Cabeçalho do Cartão e Entrada em Sequência */
.card-header {
  margin-bottom: 24px;
  text-align: center;
}

.logo-hero {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  animation: elem-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.logo-wrapper {
  position: relative;
  width: 76px;
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.official-cube-logo {
  width: 76px;
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(168, 85, 247, 0.65));
  animation: logo-float 3.8s ease-in-out infinite;
  will-change: transform;
}

.logo-glow-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.35) 0%, rgba(56, 189, 248, 0.15) 50%, transparent 75%);
  pointer-events: none;
  animation: glow-pulse 4s infinite alternate;
}

@keyframes logo-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

@keyframes glow-pulse {
  0% { transform: scale(0.92); opacity: 0.55; }
  100% { transform: scale(1.18); opacity: 0.95; }
}

.card-title-group {
  text-align: center;
  animation: elem-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.3s both;
}

.card-title {
  font-size: 2.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 35%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.card-tagline {
  font-size: 0.95rem;
  color: #e2e8f0;
  line-height: 1.4;
  margin-bottom: 4px;
}

.card-tagline strong {
  color: var(--accent-cyan);
  font-weight: 600;
}

.card-subtitle {
  font-size: 0.825rem;
  color: var(--text-muted);
  line-height: 1.45;
}

/* ==========================================================================
   Formulário, Inputs e Entrada em Sequência
   ========================================================================= */

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 22px;
}

.form-group-username {
  animation: elem-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.45s both;
}

.form-group-password {
  animation: elem-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.6s both;
}

.totp-group {
  animation: elem-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.7s both;
}

@keyframes elem-enter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.form-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: all 0.2s ease;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.form-input::placeholder {
  color: var(--text-muted);
  opacity: 0.7;
}

.form-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--focus-glow), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.font-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
}

/* Mensagem de Estado / Erro */
.status-msg {
  min-height: 20px;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: all 0.2s ease;
  text-align: left;
}

.status-msg.has-error {
  padding: 10px 14px;
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-input);
  color: var(--error-text);
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}

/* Botão de Envio */
.submit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 14px;
  margin-top: 6px;
  background: var(--btn-gradient);
  border: none;
  border-radius: var(--radius-input);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
  animation: elem-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.75s both;
}

.submit-btn:hover:not(:disabled) {
  background: var(--btn-hover);
  box-shadow: 0 6px 22px rgba(168, 85, 247, 0.55);
  transform: translateY(-1px);
}

.submit-btn:active:not(:disabled) {
  transform: translateY(0);
}

.submit-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus-glow), 0 4px 15px rgba(37, 99, 235, 0.4);
}

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

/* Spinner animado */
.btn-loader {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.submit-btn.is-loading .btn-text {
  opacity: 0.85;
}

.submit-btn.is-loading .btn-loader {
  display: inline-block;
}

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

/* Rodapé do Cartão */
.card-footer {
  margin-top: 24px;
  display: flex;
  justify-content: center;
  animation: elem-enter 0.7s cubic-bezier(0.16, 1, 0.3, 1) 0.9s both;
}

.features-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dot-sep {
  opacity: 0.4;
}

/* ==========================================================================
   Responsividade: Desktop Paisagem vs Mobile Retrato
   ========================================================================== */

/* Telas médias e grandes em paisagem: vídeo amplo ao lado do cartão */
@media (min-width: 960px) and (orientation: landscape) {
  .page-container {
    flex-direction: row;
    gap: clamp(32px, 4.5vw, 64px);
  }
  .stage-panel {
    display: flex;
  }
}

/* Telas menores ou modo retrato (celular ou tablet vertical) */
@media (max-width: 959px), (orientation: portrait) {
  .stage-panel {
    display: none;
  }
  .page-container {
    flex-direction: column;
    justify-content: center;
    padding: 24px 16px;
  }
  .auth-panel {
    flex: 0 1 auto;
    width: min(400px, 100%);
  }
  .glass-card {
    padding: 34px 26px;
    /* Orquestrador (2026-10-10): cartão mais translúcido para o clipe aparecer no celular (D6). */
    background: rgba(10, 16, 32, 0.62);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85), 0 0 35px rgba(168, 85, 247, 0.22);
  }
  .ambient-video {
    /* Em retrato o clipe é a cena principal: nítido, em tela cheia. */
    filter: blur(1px) saturate(150%) brightness(0.72);
    transform: scale(1.02);
    opacity: 0.95;
  }
  .backdrop-overlay {
    background: radial-gradient(circle at 50% 50%, rgba(10, 16, 32, 0.2) 0%, rgba(6, 9, 19, 0.75) 100%);
  }
}

/* ==========================================================================
   Acessibilidade: prefers-reduced-motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .glass-card,
  .logo-hero,
  .card-title-group,
  .form-group-username,
  .form-group-password,
  .totp-group,
  .submit-btn,
  .card-footer {
    opacity: 1 !important;
    transform: none !important;
  }
  .ambient-video, .main-video {
    display: none !important;
  }
  .cinema-backdrop {
    background-image: url("media/login-poster.jpg");
    background-size: cover;
    background-position: center;
    filter: brightness(0.45);
  }
  .stage-frame {
    background-image: url("media/login-poster.jpg");
    background-size: cover;
    background-position: center;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
  }
  .official-cube-logo, .logo-glow-ring {
    animation: none !important;
  }
}
