@import './styles.css';

html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

/* Global Styles */
body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  margin: 0;
  padding: 0;
  background-color: #f8f8f8;
  background-image: linear-gradient(135deg, #f8f8f8 0%, #f0f0f0 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  color: #555;
  position: relative;
  overflow-x: hidden;
}

/* Corrige o overflow em dispositivos móveis */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

.app-title-right {
  font-size: 2.2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 20px;
  margin-top: -20px;
  color: #555;
  width: 100%;
  padding: 0 10px;
  box-sizing: border-box;
  word-wrap: break-word;
}

.login-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.login-logo-container {
  text-align: left;
}

.login-logo {
  width: auto;
  height: 80px;
  display: block;
}

input, button, textarea, select, a {
  font-family: 'Poppins', sans-serif;
  transition: all 0.3s ease;
}

.main-container {
  display: flex;
  flex-direction: row;
  width: 80%;
  max-width: 1200px;
  height: auto;
  margin: auto;
  background-color: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

/* Ajuste para centralizar login-left na primeira metade */
.login-left {
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 50px;
  height: 100%;
  position: relative;
  background-color: #fff;
  transition: all 0.3s ease;
}

#loginForm {
  width: 100%;
  display: flex;
  flex-direction: column;
  margin: 0;
}

.logo img {
  width: 150px;
  margin-bottom: 20px;
}

h1 {
  font-size: 2.2rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 10px;
}

p {
  font-size: 1rem;
  color: #666;
  width: 100%;
  line-height: 1.6;
  margin-bottom: 30px;
}

p a {
  color: #fc7dda;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
}

p a:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: #fc7dda;
  transition: width 0.3s ease;
}

p a:hover:after {
  width: 100%;
}

p a:hover {
  color: #fc7dda;
  text-decoration: none;
}

.input-group {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin-bottom: 25px;
}

.input-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.input-wrapper input {
  width: 100%;
  padding: 15px;
  padding-right: 40px;
  height: 50px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1rem;
  box-sizing: border-box;
  transition: all 0.3s ease;
  background-color: #fafafa;
}

input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 15px;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  font-size: 1rem;
  box-sizing: border-box;
  background-color: #fafafa;
}

.toggle-password {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  width: 22px;
  height: 22px;
  opacity: 0.6;
  transition: opacity 0.3s ease;
  z-index: 10;
}

.toggle-password:hover {
  opacity: 1;
}

#email {
  margin-bottom: 0;
}

#password {
  margin-bottom: 0;
}

label {
  font-size: 0.95rem;
  color: #666;
  margin-bottom: 8px;
  font-weight: 500;
}

input:focus {
  border-color: #fc7dda;
  outline: none;
  box-shadow: 0 0 0 3px rgba(252, 125, 218, 0.1);
  background-color: #fff;
}

.options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 20px 0 30px;
}

.options label {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: normal;
  font-size: 0.9rem;
  color: #666;
  cursor: pointer;
}

.options input[type="checkbox"] {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  cursor: pointer;
  accent-color: #fc7dda;
}

.options a {
  text-decoration: none;
  color: #666;
  font-size: 0.9rem;
  transition: color 0.3s ease;
  font-weight: 500;
}

.options a:hover {
  color: #fc7dda;
}

.forgot-password {
  text-align: right;
}

.mobile-logo {
  display: none;
  width: 120px;
  height: auto;
  margin: 0 auto 20px;
}

.btn {
  width: 100%;
  padding: 15px;
  background-color: #fc7dda;
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  margin: 15px auto;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(252, 125, 218, 0.2);
}

.btn:hover {
  background-color: #f3b1e2;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(252, 125, 218, 0.25);
}

.btn:active {
  transform: translateY(0);
}

.social-login {
  margin-top: 30px;
  text-align: center;
  width: 100%;
}

.social-login p {
  width: 100%;
  margin: 0 auto 20px;
  text-align: center;
  color: #888;
  font-size: 0.9rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.social-login p:before,
.social-login p:after {
  content: '';
  height: 1px;
  background-color: #e0e0e0;
  flex: 1;
}

.social-login p:before {
  margin-right: 15px;
}

.social-login p:after {
  margin-left: 15px;
}

.social-icons {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.social-icons a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  background-color: #fafafa;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.social-icons a:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.social-icons a img {
  width: 24px;
  height: 24px;
}

/* Right Section - Mantido como estava, apenas com ajustes mínimos */
.login-right {
  flex: none;
  width: 50%;
  max-width: 600px;
  background: #f2bfe4;
  color: #555;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: auto;
  border-radius: 20px;
  padding: 20px;
  margin: 20px;
  box-sizing: border-box;
  overflow: hidden;
}

/* Header */
.login-header {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  width: 98%;
  margin-bottom: 10px;
  padding: 20px 20px 0 0;
  box-sizing: border-box;
}

.icon-and-text {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  overflow: hidden;
}

.icon-and-text img {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.contact-info {
  color: #555;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Body */
.login-body {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-top: 10px;
}

.secondary_logo {
  width: 150px;
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

.login-footer {
  width: 100%;
  text-align: left;
  padding: 0px 0px 40px 40px;
  box-sizing: border-box;
}

.footer-text {
  font-size: 0.95rem;
  color: #555;
  margin-top: 10px;
  line-height: 1.5;
  max-width: 90%;
  word-wrap: break-word;
}

.login-footer h2 {
  font-size: 1.4rem;
  margin-bottom: 10px;
  margin-left: 0;
  max-width: 90%;
  word-wrap: break-word;
}

.login-footer h2,
.login-footer p {
  margin: 0;
  padding: 0;
  text-align: left;
}

.footer-text {
  font-size: 1rem;
  color: #555;
  margin-top: 5px;
  line-height: 1.5;
}

.contact-info {
  width: 100%;
  font-size: var(--font-size-normal);
}

/* Estilização melhorada da mensagem de erro */
.error-message {
  background-color: #fff0f0;
  color: #b00020;
  padding: 12px 18px;
  border: 1px solid #ffccd5;
  border-radius: 12px;
  font-size: 0.9rem;
  margin-bottom: 20px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeIn 0.5s ease-in-out;
  box-shadow: 0 2px 8px rgba(176, 0, 32, 0.1);
}

.error-message::before {
  content: "⚠️";
  font-size: 1.2rem;
  flex-shrink: 0;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Estilo aprimorado do Loader */
.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  backdrop-filter: blur(3px);
}

.spinner-circle {
  width: 50px;
  height: 50px;
  border: 3px solid #f2f2f2;
  border-top: 3px solid #fc7dda;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Melhorias de responsividade */
@media (max-width: 1284px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px 10px;
    height: 100vh;
    overflow-y: auto;
  }
  
  .main-container {
    flex-direction: column;
    width: 90%;
    max-width: 420px;
    margin: 0 auto;
    height: auto;
    display: flex;
    justify-content: center;
  }
  
  .login-left {
    width: 100%;
    padding: 30px 20px;
    border-radius: 20px;
    height: auto;
    min-height: auto;
    margin-bottom: 20px;
    box-sizing: border-box;
  }
  
  .login-right {
    display: none;
  }
  
  .mobile-logo {
    display: block;
    width: 120px;
    margin: 0 auto 25px;
  }
  
  h1 {
    font-size: 1.8rem;
    text-align: center;
    margin-bottom: 15px;
  }
  
  p {
    text-align: center;
    font-size: 0.95rem;
  }
  
  .btn {
    padding: 14px;
  }
  
  #loginForm {
    width: 100%;
    margin-left: 0;
  }
}

/* Ajustes específicos para dispositivos móveis menores */
@media screen and (max-width: 480px) {
  body {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
    height: 100vh;
  }
  
  .main-container {
    width: 100%;
    margin: 0;
    box-shadow: none;
    overflow: visible;
  }
  
  .login-left {
    padding: 20px 15px;
    border-radius: 15px;
    overflow: visible;
  }
  
  .options {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
  }
  
  .options label {
    font-size: 0.85rem;
    white-space: nowrap;
  }
  
  .forgot-password {
    font-size: 0.85rem;
    white-space: nowrap;
    text-align: right;
  }
  
  input[type="email"],
  input[type="password"] {
    padding: 12px;
    height: 45px;
  }
  
  .btn {
    padding: 12px;
    font-size: 0.95rem;
    margin-top: 10px;
  }
  
  .social-login {
    margin-top: 20px;
  }
  
  /* Ajuste para que o checkbox e o texto fiquem na mesma linha */
  .options label {
    display: flex;
    align-items: center;
    gap: 5px;
  }
  
  /* Garantir que o formulário não seja cortado */
  #loginForm {
    width: 100%;
    box-sizing: border-box;
  }
  
  /* Espaçamento entre campos */
  .input-group {
    margin-bottom: 15px;
  }
}

/* Correção específica para iPhone */
@supports (-webkit-touch-callout: none) {
  body {
    height: auto;
    min-height: 100vh;
    position: relative;
    -webkit-overflow-scrolling: touch;
  }
  
  .main-container {
    height: auto;
    min-height: auto;
    padding-bottom: 20px;
    position: relative;
    margin: 15px auto;
  }
  
  .options {
    display: flex;
    flex-wrap: nowrap;
    margin-bottom: 15px;
  }
  
  .forgot-password {
    white-space: nowrap;
  }
  
  /* Fix para telas pequenas em orientação retrato */
  @media screen and (max-height: 700px) {
    body {
      height: auto;
      padding: 15px 10px;
      overflow-y: auto;
    }
    
    .main-container {
      margin: 0 auto;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    }
    
    .login-left {
      padding: 15px;
    }
    
    h1 {
      font-size: 1.6rem;
      margin-bottom: 10px;
    }
    
    p {
      margin-bottom: 15px;
      font-size: 0.9rem;
    }
    
    .input-group {
      margin-bottom: 12px;
    }
    
    .btn {
      margin: 10px 0;
      padding: 10px;
    }
    
    .social-login {
      margin-top: 15px;
    }
  }
}