/* Reset e configurações básicas */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  min-height: 100vh;
  color: #212529;
  line-height: 1.6;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Layout principal */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  width: 100%;
  position: relative;
}

.login-page {
  width: 100%;
  max-width: 500px;
  background: white;
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1);
  padding: 40px;
  position: relative;
  overflow: hidden;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-page::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #000, #333, #000);
}

/* Header */
.login-header {
  text-align: center;
  margin-bottom: 40px;
  position: relative;
}

.login-header::before {
  content: '';
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: linear-gradient(90deg, #000, #333);
  border-radius: 2px;
}

.login-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0 0 12px;
  color: #212529;
  background: linear-gradient(135deg, #212529, #000);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
}

.login-subtitle {
  color: #6c757d;
  font-size: 16px;
  margin: 0;
  font-weight: 400;
  line-height: 1.4;
}

/* Formulário */
.form-container {
  width: 100%;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 24px;
  position: relative;
}

.form-label {
  font-weight: 600;
  color: #212529;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.form-label i {
  width: 18px;
  height: 18px;
  color: #000;
  opacity: 0.8;
}

.form-label .required {
  color: #dc3545;
  font-size: 18px;
  font-weight: 700;
}

.form-input {
  padding: 16px 20px;
  border: 2px solid #dee2e6;
  border-radius: 12px;
  font-size: 16px;
  background: white;
  color: #212529;
  transition: all 0.3s ease;
  font-family: inherit;
}

.form-input:focus {
  outline: none;
  border-color: #000;
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

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

.form-input::placeholder {
  color: #6c757d;
  opacity: 0.7;
}

.form-input.error {
  border-color: #dc3545;
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.1);
}

.form-input.valid {
  border-color: #28a745;
  box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.1);
}

.form-help {
  font-size: 13px;
  color: #6c757d;
  margin-top: 6px;
  font-style: italic;
  opacity: 0.8;
}

/* Botão */
.btn-login {
  width: 100%;
  padding: 18px 32px;
  background: linear-gradient(135deg, #000, #333);
  color: white;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 24px;
}

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

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

.btn-login:hover {
  background: linear-gradient(135deg, #333, #000);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

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

.btn-login.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn-login.loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid transparent;
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* ===== TEMA ESCURO ===== */
[data-theme="dark"],
html.tema-escuro,
body.tema-escuro,
html.tema-escuro body,
.tema-escuro body {
  background: linear-gradient(135deg, #1d1d1f 0%, #2d2d30 100%) !important;
  color: #f5f5f7;
}

[data-theme="dark"] body,
html.tema-escuro body,
body.tema-escuro {
  background: linear-gradient(135deg, #1d1d1f 0%, #2d2d30 100%) !important;
  color: #f5f5f7;
}

[data-theme="dark"] .login-page,
html.tema-escuro .login-page,
body.tema-escuro .login-page,
.tema-escuro .login-page {
  background: #2d2d30;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .login-page::before,
html.tema-escuro .login-page::before,
body.tema-escuro .login-page::before,
.tema-escuro .login-page::before {
  background: linear-gradient(90deg, #f5f5f7, #86868b, #f5f5f7);
}

[data-theme="dark"] .login-header::before,
html.tema-escuro .login-header::before,
body.tema-escuro .login-header::before,
.tema-escuro .login-header::before {
  background: linear-gradient(90deg, #f5f5f7, #86868b);
}

[data-theme="dark"] .login-title,
html.tema-escuro .login-title,
body.tema-escuro .login-title,
.tema-escuro .login-title {
  color: #f5f5f7;
  background: linear-gradient(135deg, #f5f5f7, #ffffff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .login-subtitle,
html.tema-escuro .login-subtitle,
body.tema-escuro .login-subtitle,
.tema-escuro .login-subtitle {
  color: #86868b;
}

[data-theme="dark"] .form-label,
html.tema-escuro .form-label,
body.tema-escuro .form-label,
.tema-escuro .form-label {
  color: #f5f5f7;
}

[data-theme="dark"] .form-label i,
html.tema-escuro .form-label i,
body.tema-escuro .form-label i,
.tema-escuro .form-label i {
  color: #f5f5f7;
  opacity: 0.8;
}

[data-theme="dark"] .form-input,
html.tema-escuro .form-input,
body.tema-escuro .form-input,
.tema-escuro .form-input {
  background: #1d1d1f;
  color: #f5f5f7;
  border-color: #404040;
}

[data-theme="dark"] .form-input:focus,
html.tema-escuro .form-input:focus,
body.tema-escuro .form-input:focus,
.tema-escuro .form-input:focus {
  border-color: #f5f5f7;
  box-shadow: 0 0 0 4px rgba(245, 245, 247, 0.08);
}

[data-theme="dark"] .form-input:hover,
html.tema-escuro .form-input:hover,
body.tema-escuro .form-input:hover,
.tema-escuro .form-input:hover {
  border-color: #86868b;
}

[data-theme="dark"] .form-input::placeholder,
html.tema-escuro .form-input::placeholder,
body.tema-escuro .form-input::placeholder,
.tema-escuro .form-input::placeholder {
  color: #86868b;
}

[data-theme="dark"] .form-help,
html.tema-escuro .form-help,
body.tema-escuro .form-help,
.tema-escuro .form-help {
  color: #86868b;
}

[data-theme="dark"] .btn-login,
html.tema-escuro .btn-login,
body.tema-escuro .btn-login,
.tema-escuro .btn-login {
  background: linear-gradient(135deg, #f5f5f7, #ffffff);
  color: #1d1d1f;
}

[data-theme="dark"] .btn-login::before,
html.tema-escuro .btn-login::before,
body.tema-escuro .btn-login::before,
.tema-escuro .btn-login::before {
  background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.2), transparent);
}

[data-theme="dark"] .btn-login:hover,
html.tema-escuro .btn-login:hover,
body.tema-escuro .btn-login:hover,
.tema-escuro .btn-login:hover {
  background: linear-gradient(135deg, #ffffff, #f5f5f7);
}

[data-theme="dark"] .btn-login.loading::after,
html.tema-escuro .btn-login.loading::after,
body.tema-escuro .btn-login.loading::after,
.tema-escuro .btn-login.loading::after {
  border-top: 2px solid #1d1d1f;
}

[data-theme="dark"] .divider,
html.tema-escuro .divider,
body.tema-escuro .divider,
.tema-escuro .divider {
  background: #404040;
}

[data-theme="dark"] .divider::after,
html.tema-escuro .divider::after,
body.tema-escuro .divider::after,
.tema-escuro .divider::after {
  background: #2d2d30;
  color: #86868b;
}

[data-theme="dark"] .login-link,
html.tema-escuro .login-link,
body.tema-escuro .login-link,
.tema-escuro .login-link {
  color: #86868b;
  background: #1d1d1f;
  border-color: #404040;
}

[data-theme="dark"] .login-link:hover,
html.tema-escuro .login-link:hover,
body.tema-escuro .login-link:hover,
.tema-escuro .login-link:hover {
  color: #f5f5f7;
  background: #2d2d30;
  border-color: #86868b;
}

[data-theme="dark"] .mensagem.sucesso,
html.tema-escuro .mensagem.sucesso,
body.tema-escuro .mensagem.sucesso,
.tema-escuro .mensagem.sucesso {
  background: linear-gradient(135deg, #1e4620, #2d5a32);
  color: #d4edda;
  border-left-color: #28a745;
}

[data-theme="dark"] .mensagem.erro,
html.tema-escuro .mensagem.erro,
body.tema-escuro .mensagem.erro,
.tema-escuro .mensagem.erro {
  background: linear-gradient(135deg, #5a1e1e, #721c24);
  color: #f8d7da;
  border-left-color: #dc3545;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Divisor */
.divider {
  height: 1px;
  background: #dee2e6;
  margin: 24px 0;
  position: relative;
}

.divider::after {
  content: 'ou';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 0 12px;
  color: #6c757d;
  font-size: 12px;
  font-weight: 500;
}

/* Links de ação */
.login-actions {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.login-link {
  color: #000;
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
}

.login-link:hover {
  color: #333;
  background: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.login-link i {
  width: 16px;
  height: 16px;
}

/* Mensagens */
.mensagem {
  padding: 20px 24px;
  border-radius: 12px;
  margin-bottom: 32px;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  position: relative;
  border-left: 4px solid;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.mensagem.sucesso {
  background: linear-gradient(135deg, #d4edda, #c3e6cb);
  color: #155724;
  border-left-color: #28a745;
}

.mensagem.erro {
  background: linear-gradient(135deg, #f8d7da, #f5c6cb);
  color: #721c24;
  border-left-color: #dc3545;
}

.mensagem i {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Animações */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.login-page {
  animation: fadeInUp 0.6s ease-out;
}

.form-group {
  animation: fadeInUp 0.6s ease-out;
  animation-fill-mode: both;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }

.btn-login {
  animation: fadeInUp 0.6s ease-out 0.3s both;
}

.login-actions {
  animation: fadeInUp 0.6s ease-out 0.4s both;
}

/* Responsividade */
@media (max-width: 1024px) {
  .login-page {
    padding: 36px 28px;
    max-width: 90%;
  }
}

@media (max-width: 768px) {
  .page-wrapper {
    padding: 16px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .login-page {
    padding: 32px 24px;
    border-radius: 16px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
  }
  
  .login-header {
    margin-bottom: 32px;
  }
  
  .login-title {
    font-size: 28px;
  }
  
  .login-subtitle {
    font-size: 15px;
  }
  
  .form-group {
    margin-bottom: 20px;
  }
  
  .form-label {
    font-size: 14px;
  }
  
  .form-input {
    padding: 14px 16px;
    font-size: 15px;
  }
  
  .btn-login {
    padding: 16px 24px;
    font-size: 15px;
  }
  
  .login-link {
    padding: 10px 16px;
    font-size: 14px;
  }
  
  .divider {
    margin: 20px 0;
  }
}

@media (max-width: 480px) {
  .page-wrapper {
    padding: 12px;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .login-page {
    padding: 24px 20px;
    border-radius: 12px;
    max-width: 100%;
    width: 100%;
    margin: 0 auto;
  }
  
  .login-header {
    margin-bottom: 24px;
  }
  
  .login-header::before {
    width: 50px;
    height: 3px;
  }
  
  .login-title {
    font-size: 24px;
  }
  
  .login-subtitle {
    font-size: 14px;
  }
  
  .form-group {
    margin-bottom: 18px;
  }
  
  .form-label {
    font-size: 13px;
    margin-bottom: 6px;
  }
  
  .form-label i {
    width: 16px;
    height: 16px;
  }
  
  .form-input {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
  }
  
  .form-help {
    font-size: 12px;
  }
  
  .btn-login {
    padding: 14px 20px;
    font-size: 14px;
    border-radius: 12px;
  }
  
  .login-link {
    padding: 8px 12px;
    font-size: 13px;
    border-radius: 8px;
  }
  
  .divider {
    margin: 16px 0;
  }
  
  .divider::after {
    padding: 0 10px;
    font-size: 11px;
  }
  
  .mensagem {
    padding: 16px 20px;
    font-size: 14px;
  }
}