/**
 * CSS Moderno e Otimizado para Telas de Login
 * Rede RWP - Sistema de Login
 * Otimizado para performance em dispositivos de baixo desempenho
 */

/* =================================================================== */
/* == 1. Variáveis Globais == */
/* =================================================================== */
:root {
  --primary-color: #ff4500;
  --primary-dark: #e03e00;
  --primary-light: #ff6b35;
  --secondary-color: #ffd700;
  --accent-color: #ff6b35;
  --dark-color: #1a1a1a;
  --light-color: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f1f3f5;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  --gradient-primary: linear-gradient(
    135deg,
    var(--primary-color),
    var(--accent-color)
  );
  --gradient-secondary: linear-gradient(
    135deg,
    var(--secondary-color),
    #ffa500
  );

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 8px 25px rgba(0, 0, 0, 0.2);
  --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.3);

  --border-radius: 12px;
  --border-radius-lg: 20px;
  --border-radius-xl: 30px;

  --transition: all 0.2s ease;
  --transition-fast: all 0.15s ease;
}

/* =================================================================== */
/* == 2. Reset e Base == */
/* =================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.login-page {
  background: linear-gradient(
      135deg,
      rgba(26, 26, 26, 0.85),
      rgba(255, 69, 0, 0.15)
    ),
    url("../img/banner.png") center / cover no-repeat;
  background-attachment: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 1rem;
  contain: layout style paint;
}

/* =================================================================== */
/* == 3. Estilos Específicos - LOGIN EMPRESA == */
/* =================================================================== */
body.login-page:not(.funcionarios) {
  background: linear-gradient(
      135deg,
      rgba(26, 26, 26, 0.88),
      rgba(255, 69, 0, 0.2)
    ),
    url("../img/banner.png") center / cover no-repeat;
}

body.login-page:not(.funcionarios) .login-container {
  border-top: 4px solid var(--primary-color);
  box-shadow: 0 20px 50px rgba(255, 69, 0, 0.25), var(--shadow-xl);
}

body.login-page:not(.funcionarios) .login-title {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

body.login-page:not(.funcionarios) .login-title::after {
  content: "🏢";
  display: inline-block;
  margin-left: 12px;
  font-size: 2rem;
  vertical-align: middle;
  filter: grayscale(0);
}

body.login-page:not(.funcionarios) .login-subtitle {
  color: var(--gray-700);
  font-weight: 500;
}

body.login-page:not(.funcionarios) .btn-login {
  background: var(--gradient-primary);
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.35);
}

body.login-page:not(.funcionarios) .btn-login:hover {
  box-shadow: 0 8px 25px rgba(255, 69, 0, 0.45);
  transform: translateY(-2px);
}

body.login-page:not(.funcionarios) .form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(255, 69, 0, 0.15);
}

body.login-page:not(.funcionarios) .security-badge {
  background: linear-gradient(
    135deg,
    rgba(255, 69, 0, 0.1),
    rgba(255, 107, 53, 0.1)
  );
  border-color: rgba(255, 69, 0, 0.3);
}

/* =================================================================== */
/* == 4. Estilos Específicos - LOGIN FUNCIONÁRIOS == */
/* =================================================================== */
body.login-page.funcionarios {
  background: linear-gradient(
      135deg,
      rgba(30, 30, 40, 0.9),
      rgba(70, 130, 180, 0.15)
    ),
    url("../img/wallpaper-works.jpg") center / cover no-repeat;
  background-attachment: fixed;
}

body.login-page.funcionarios .login-container {
  border-top: 4px solid #4682b4;
  box-shadow: 0 20px 50px rgba(70, 130, 180, 0.2), var(--shadow-xl);
  background: rgba(255, 255, 255, 0.98);
}

body.login-page.funcionarios .login-title {
  background: linear-gradient(135deg, #4682b4, #5a9bd4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}

body.login-page.funcionarios .login-title::after {
  content: "👤";
  display: inline-block;
  margin-left: 12px;
  font-size: 2rem;
  vertical-align: middle;
}

body.login-page.funcionarios .login-subtitle {
  color: var(--gray-600);
  font-weight: 400;
}

body.login-page.funcionarios .btn-login {
  background: linear-gradient(135deg, #4682b4, #5a9bd4);
  box-shadow: 0 4px 15px rgba(70, 130, 180, 0.3);
}

body.login-page.funcionarios .btn-login:hover {
  box-shadow: 0 8px 25px rgba(70, 130, 180, 0.4);
  transform: translateY(-2px);
}

body.login-page.funcionarios .form-control:focus {
  border-color: #4682b4;
  box-shadow: 0 0 0 4px rgba(70, 130, 180, 0.15);
}

body.login-page.funcionarios .input-icon {
  color: var(--gray-500);
}

body.login-page.funcionarios .form-control:focus ~ .input-icon,
body.login-page.funcionarios .form-group:has(.form-control:focus) .input-icon {
  color: #4682b4;
}

body.login-page.funcionarios .password-toggle:hover {
  color: #4682b4;
  background: rgba(70, 130, 180, 0.1);
}

body.login-page.funcionarios .security-badge {
  background: linear-gradient(
    135deg,
    rgba(70, 130, 180, 0.1),
    rgba(90, 155, 212, 0.1)
  );
  border-color: rgba(70, 130, 180, 0.3);
}

body.login-page.funcionarios .security-badge i {
  color: #4682b4;
}

body.login-page.funcionarios .forgot-password a:hover {
  color: #4682b4;
}

body.login-page.funcionarios .forgot-password a::after {
  background: linear-gradient(135deg, #4682b4, #5a9bd4);
}

/* =================================================================== */
/* == 5. Animações de Fundo (Otimizadas) == */
/* =================================================================== */
.bg-animation {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  contain: layout style paint;
  will-change: transform;
}

.floating-shape {
  position: absolute;
  opacity: 0.06;
  will-change: transform;
  transform: translateZ(0);
}

/* Reduzir animações em dispositivos de baixo desempenho */
@media (prefers-reduced-motion: no-preference) {
  .floating-shape {
    animation: floatSimple 12s ease-in-out infinite;
  }

  .floating-shape:nth-child(1) {
    top: 15%;
    left: 10%;
    animation-delay: 0s;
  }

  .floating-shape:nth-child(2) {
    top: 60%;
    right: 10%;
    animation-delay: 3s;
  }

  .floating-shape:nth-child(3) {
    bottom: 20%;
    left: 20%;
    animation-delay: 6s;
  }

  .floating-shape:nth-child(4) {
    top: 40%;
    right: 20%;
    animation-delay: 1.5s;
  }

  @keyframes floatSimple {
    0%,
    100% {
      transform: translateY(0px) translateZ(0);
    }
    50% {
      transform: translateY(-20px) translateZ(0);
    }
  }
}

/* Desabilitar animações em dispositivos de baixo desempenho */
@media (prefers-reduced-motion: reduce) {
  .floating-shape {
    animation: none !important;
    opacity: 0.03;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =================================================================== */
/* == 6. Container de Login == */
/* =================================================================== */
.login-container {
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--border-radius-xl);
  padding: 3rem 2.5rem;
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  position: relative;
  z-index: 10;
  border: 1px solid rgba(255, 255, 255, 0.3);
  animation: slideUp 0.6s ease-out;
  contain: layout style paint;
  transform: translateZ(0);
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(40px) translateZ(0);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }
}

/* =================================================================== */
/* == 7. Logo == */
/* =================================================================== */
.login-container .logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-container .logo img {
  height: 80px;
  width: auto;
  transition: transform 0.2s ease;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.15));
  object-fit: contain;
  transform: translateZ(0);
}

.login-container .logo img:hover {
  transform: scale(1.05) translateZ(0);
}

/* =================================================================== */
/* == 8. Títulos == */
/* =================================================================== */
.login-title {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2.5rem;
  color: var(--dark-color);
  text-align: center;
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
  line-height: 1.1;
  transform: translateZ(0);
}

.login-subtitle {
  text-align: center;
  color: var(--gray-600);
  margin-bottom: 2rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
}

/* =================================================================== */
/* == 9. Formulário == */
/* =================================================================== */
.login-form {
  margin-top: 1rem;
}

.form-group {
  position: relative;
  margin-bottom: 1.5rem;
}

.form-control {
  border: 2px solid var(--gray-300);
  border-radius: var(--border-radius);
  padding: 14px 18px 14px 50px;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  background: rgba(255, 255, 255, 0.95);
  width: 100%;
  color: var(--dark-color);
  font-weight: 400;
  transform: translateZ(0);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(255, 69, 0, 0.12);
  outline: none;
  background: white;
  transform: translateY(-1px) translateZ(0);
}

.form-control::placeholder {
  color: var(--gray-500);
  font-weight: 400;
  opacity: 0.7;
}

.form-control:focus::placeholder {
  opacity: 0.5;
}

/* Ícones de Input */
.input-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%) translateZ(0);
  color: var(--gray-500);
  font-size: 1.1rem;
  transition: color 0.2s ease, transform 0.2s ease;
  z-index: 5;
  pointer-events: none;
}

.form-control:focus ~ .input-icon,
.form-group:has(.form-control:focus) .input-icon {
  color: var(--primary-color);
  transform: translateY(-50%) scale(1.05) translateZ(0);
}

/* Toggle de Senha */
.password-toggle {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%) translateZ(0);
  background: none;
  border: none;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
  z-index: 5;
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}

.password-toggle:hover {
  color: var(--primary-color);
  background: rgba(255, 69, 0, 0.1);
  transform: translateY(-50%) scale(1.1) translateZ(0);
}

.password-toggle:active {
  transform: translateY(-50%) scale(0.95) translateZ(0);
}

/* Checkbox Lembrar-me */
.form-check {
  margin-bottom: 1.25rem;
  padding-left: 0;
}

.form-check-input {
  width: 18px;
  height: 18px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: var(--primary-color);
  border: 2px solid var(--gray-400);
  transition: border-color 0.2s ease;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(255, 69, 0, 0.15);
  border-color: var(--primary-color);
}

.form-check-label {
  color: var(--gray-700);
  font-size: 0.95rem;
  cursor: pointer;
  user-select: none;
  font-weight: 400;
  transition: color 0.2s ease;
}

.form-check-label:hover {
  color: var(--dark-color);
}

body.login-page.funcionarios .form-check-input {
  accent-color: #4682b4;
}

body.login-page.funcionarios .form-check-input:checked {
  background-color: #4682b4;
  border-color: #4682b4;
}

body.login-page.funcionarios .form-check-input:focus {
  box-shadow: 0 0 0 3px rgba(70, 130, 180, 0.15);
  border-color: #4682b4;
}

/* Dica de Login - Funcionários */
.login-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  margin-bottom: 1.25rem;
  background: linear-gradient(
    135deg,
    rgba(70, 130, 180, 0.08),
    rgba(90, 155, 212, 0.08)
  );
  border: 1px solid rgba(70, 130, 180, 0.2);
  border-radius: var(--border-radius);
  font-size: 0.85rem;
  color: var(--gray-700);
  line-height: 1.5;
}

.login-hint i {
  color: #4682b4;
  font-size: 1rem;
  margin-top: 2px;
  flex-shrink: 0;
}

.login-hint span {
  flex: 1;
}

/* =================================================================== */
/* == 10. Botão de Login == */
/* =================================================================== */
.btn-login {
  background: var(--gradient-primary);
  border: none;
  border-radius: var(--border-radius);
  padding: 15px 30px;
  font-size: 1.05rem;
  font-weight: 600;
  color: white;
  width: 100%;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
  transform: translateZ(0);
}

.btn-login::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.25),
    transparent
  );
  transition: left 0.5s ease;
}

.btn-login:hover::before {
  left: 100%;
}

.btn-login:hover {
  transform: translateY(-2px) translateZ(0);
  box-shadow: 0 8px 25px rgba(255, 69, 0, 0.4);
}

.btn-login:active {
  transform: translateY(0) translateZ(0);
  box-shadow: 0 4px 15px rgba(255, 69, 0, 0.3);
}

.btn-login:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Estado de Loading */
.btn-login.loading {
  pointer-events: none;
  opacity: 0.85;
}

.btn-login.loading .btn-text {
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-login .spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(0);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.btn-login.loading .spinner {
  opacity: 1;
}

/* =================================================================== */
/* == 11. Badge de Segurança == */
/* =================================================================== */
.security-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--gray-600);
  font-size: 0.875rem;
  margin-top: 1rem;
  padding: 10px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  transition: background 0.2s ease, border-color 0.2s ease;
}

.security-badge:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--primary-color);
}

.security-badge i {
  color: var(--primary-color);
  font-size: 1rem;
}

/* =================================================================== */
/* == 12. Links == */
/* =================================================================== */
.forgot-password {
  text-align: center;
  margin-top: 1.5rem;
}

.forgot-password a {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.forgot-password a::after {
  content: "";
  position: absolute;
  bottom: -3px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  transition: width 0.3s ease;
}

.forgot-password a:hover {
  color: var(--primary-color);
}

.forgot-password a:hover::after {
  width: 100%;
}

/* Voltar ao Site */
.back-home {
  text-align: center;
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--gray-200);
}

.back-home a {
  color: var(--gray-600);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.2s ease, transform 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.back-home a:hover {
  color: var(--primary-color);
  transform: translateX(-4px) translateZ(0);
}

.back-home a i {
  transition: transform 0.2s ease;
}

.back-home a:hover i {
  transform: translateX(-2px) translateZ(0);
}

/* =================================================================== */
/* == 13. Alertas == */
/* =================================================================== */
#message {
  margin-bottom: 1.25rem;
}

.alert {
  border-radius: var(--border-radius);
  border: none;
  padding: 14px 18px;
  margin-bottom: 0.75rem;
  animation: slideDown 0.4s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  transform: translateZ(0);
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-15px) translateZ(0);
  }
  to {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }
  to {
    opacity: 0;
    transform: translateY(-15px) translateZ(0);
  }
}

.alert-danger {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  color: white;
}

.alert-success {
  background: linear-gradient(135deg, #51cf66, #40c057);
  color: white;
}

.alert-info,
.alert-primary {
  background: linear-gradient(135deg, #4dabf7, #339af0);
  color: white;
}

.alert i {
  font-size: 1.05rem;
  flex-shrink: 0;
}

/* =================================================================== */
/* == 14. Responsividade == */
/* =================================================================== */
@media (max-width: 768px) {
  body.login-page {
    padding: 0.75rem;
  }

  .login-container {
    margin: 0;
    padding: 2.25rem 1.75rem;
    max-width: none;
    border-radius: var(--border-radius-lg);
  }

  .login-title {
    font-size: 2rem;
  }

  .login-subtitle {
    font-size: 0.95rem;
    margin-bottom: 1.75rem;
  }

  .form-control {
    padding: 12px 16px 12px 45px;
    font-size: 0.95rem;
  }

  .input-icon {
    left: 16px;
    font-size: 1rem;
  }

  .password-toggle {
    right: 16px;
    font-size: 1rem;
  }

  .btn-login {
    padding: 14px 25px;
    font-size: 1rem;
  }

  .login-container .logo img {
    height: 65px;
  }
}

@media (max-width: 480px) {
  .login-container {
    padding: 2rem 1.5rem;
    border-radius: var(--border-radius);
  }

  .login-title {
    font-size: 1.75rem;
  }

  .login-subtitle {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
  }

  .login-container .logo img {
    height: 55px;
  }

  .form-group {
    margin-bottom: 1.25rem;
  }

  .form-control {
    padding: 12px 14px 12px 42px;
  }

  .input-icon {
    left: 14px;
    font-size: 0.95rem;
  }

  .password-toggle {
    right: 14px;
    font-size: 0.95rem;
  }

  .btn-login {
    padding: 13px 20px;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
  }
}

/* =================================================================== */
/* == 15. Scrollbar Personalizada == */
/* =================================================================== */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: 4px;
  border: 1px solid var(--gray-100);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* =================================================================== */
/* == 16. Melhorias de Acessibilidade == */
/* =================================================================== */
.form-control:focus-visible,
.btn-login:focus-visible,
.password-toggle:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 2px;
}

/* =================================================================== */
/* == 17. Otimizações de Performance == */
/* =================================================================== */
.login-container,
.form-control,
.btn-login {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* Desabilitar efeitos pesados em dispositivos móveis */
@media (max-width: 768px) {
  .login-container {
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
  }

  body.login-page {
    background-attachment: scroll;
  }
}

/* Reduzir qualidade de backdrop-filter em dispositivos de baixo desempenho */
@media (max-width: 480px) {
  .login-container {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(255, 255, 255, 1);
  }
}
