* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", sans-serif;
}

.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: #ffffff;
  position: relative;
  padding: 1.5rem 1rem;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  overflow-x: hidden;
}

.video-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  opacity: 0.3;
}

.login-body::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
  z-index: -1;
}

.floating-shapes {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: -1;
}

.shape {
  position: absolute;
  background: rgba(59, 130, 246, 0.1);
  border-radius: 50%;
  animation: float 6s ease-in-out infinite;
}

.shape:nth-child(1) {
  width: 60px;
  height: 60px;
  top: 15%;
  left: 5%;
  animation-delay: 0s;
}

.shape:nth-child(2) {
  width: 80px;
  height: 80px;
  top: 70%;
  right: 5%;
  animation-delay: 2s;
  background: rgba(249, 115, 22, 0.1);
}

.shape:nth-child(3) {
  width: 40px;
  height: 40px;
  bottom: 15%;
  left: 15%;
  animation-delay: 4s;
}

.login-container {
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  padding: 1.5rem;
  width: 100%;
  max-width: 24rem;
  margin: 0 auto;
  animation: fadeIn 0.8s ease-out;
}

.login-header {
  text-align: center;
  margin-bottom: 2rem;
  animation: slideUp 0.6s ease-out 0.2s both;
}

.login-logo {
  width: 8rem;
  height: auto;
  margin: 0 auto 1rem;
  display: block;
}

.login-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: white;
}

.login-subtitle {
  font-size: 0.75rem;
  opacity: 0.7;
}

.login-form {
  animation: slideUp 0.6s ease-out 0.2s both;
}

.form-group {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
}

.form-icon {
  margin-right: 0.5rem;
  color: #60a5fa;
}

.input-field {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 8px;
  padding: 0.875rem 1rem;
  color: white;
  transition: all 0.3s ease;
  font-size: 1rem;
  width: 100%;
}

.input-field:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  background: rgba(15, 23, 42, 0.9);
}

.input-field::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.password-wrapper {
  position: relative;
  width: 100%;
}

.toggle-password {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.3s;
}

.toggle-password:hover {
  color: #60a5fa;
}

.btn-login {
  background: #ff9100;
  border: none;
  border-radius: 8px;
  padding: 0.875rem 1.5rem;
  color: white;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.3s ease;
  width: 100%;
  min-height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.btn-icon {
  margin-right: 0.5rem;
}

.btn-login:hover {
  background-color: #0e1526;
  color: #ff9100;
  border: solid #ff9100 1px;
}

.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(59, 130, 246, 0.2);
}

.footer-text {
  font-size: 0.75rem;
  opacity: 0.6;
  margin: 0;
}

.login-logg-icon {
  height: 37px;
  width: 38px;
  opacity: 1.6;
}

.flash-message {
  position: fixed;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  background: rgba(239, 68, 68, 0.9);
  border: 1px solid #f87171;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  animation: fadeIn 0.8s ease-out;
  z-index: 50;
}

.flash-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.flash-icon {
  color: white;
  font-size: 0.875rem;
}

.flash-text {
  color: white;
  font-weight: 500;
  font-size: 0.875rem;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px) rotate(0deg);
  }
  50% {
    transform: translateY(-20px) rotate(180deg);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (min-width: 640px) {
  .login-container {
    padding: 1.5rem;
  }

  .login-logo {
    width: 10rem;
  }

  .login-title {
    font-size: 1.875rem;
  }

  .login-subtitle {
    font-size: 0.875rem;
  }

  .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
  }

  .input-field {
    padding: 1rem 1.25rem;
  }

  .btn-login {
    padding: 1rem 2rem;
    font-size: 1rem;
  }

  .flash-message {
    top: 1rem;
    right: 1rem;
    left: auto;
    max-width: 24rem;
  }
}

@media (min-width: 768px) {
  .shape:nth-child(1) {
    width: 80px;
    height: 80px;
    top: 20%;
    left: 10%;
  }

  .shape:nth-child(2) {
    width: 120px;
    height: 120px;
    top: 60%;
    right: 10%;
  }

  .shape:nth-child(3) {
    width: 60px;
    height: 60px;
    bottom: 20%;
    left: 20%;
  }
}

@supports (-webkit-touch-callout: none) {
  .login-body {
    background: #0f172a url("../../img/images/bg-mobile.png") no-repeat center
      center !important;
    background-size: cover !important;
    -webkit-background-size: cover !important;
  }

  .login-body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.8) 0%,
      rgba(30, 41, 59, 0.8) 100%
    ) !important;
    z-index: -1;
  }
}

@media only screen and (device-width: 390px) and (device-height: 844px) and (-webkit-device-pixel-ratio: 3) {
  .login-body {
    background: #0f172a url("../../img/images/bg-mobile.png") no-repeat center
      center !important;
    background-size: cover !important;
    min-height: 100vh !important;
    -webkit-background-size: cover !important;
  }

  .login-body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.8) 0%,
      rgba(30, 41, 59, 0.8) 100%
    ) !important;
    z-index: -1;
  }

  .login-container {
    background: rgba(15, 23, 42, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
  }
}

@media (max-width: 640px) {
  .login-body {
    padding: 0;
    overflow-y: auto;
    background: #0f172a url("../../img/images/bg-mobile.png") no-repeat center
      center;
    background-size: cover;
    min-height: 100vh;
    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
  }

  .login-body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
      135deg,
      rgba(15, 23, 42, 0.8) 0%,
      rgba(30, 41, 59, 0.8) 100%
    );
    z-index: -1;
  }

  .video-background {
    display: none; /* Desabilita vídeo em dispositivos móveis para melhor performance */
  }

  .login-container {
    margin: 0 auto;
    padding: 1.25rem;
    min-height: auto;
    max-width: calc(100vw - 2rem);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  }

  .input-field {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    appearance: none;
    -webkit-appearance: none;
    border-radius: 8px;
    -webkit-border-radius: 8px;
  }

  .btn-login {
    padding: 0.875rem 1.25rem;
    font-size: 1rem;
    min-height: 3.125rem;
    touch-action: manipulation;
  }

  .shape {
    opacity: 0.3;
  }

  .login-form {
    animation-delay: 0.1s;
  }
}

@media (max-width: 480px) {
  .login-container {
    margin: 0.75rem;
    padding: 1rem;
    border-radius: 12px;
  }

  .input-field {
    padding: 0.75rem 0.875rem;
    font-size: 1rem;
  }

  .btn-login {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    min-height: 3rem;
  }

  .shape:nth-child(3) {
    display: none;
  }

  .login-footer {
    flex-direction: column;
    gap: 0.5rem;
  }

  .login-logg-icon {
    height: 35px;
  }
}

@media (max-width: 768px) and (orientation: landscape) {
  .login-body {
    padding: 0.5rem 0;
  }

  .login-container {
    margin: 0.5rem auto;
    padding: 1rem;
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
  }

  .floating-shapes {
    display: none; /* Hide shapes in landscape to save space */
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .login-container {
    padding: 2rem;
    max-width: 25rem;
  }
}

@media (hover: none) and (pointer: coarse) {
  .btn-login:hover {
    background-color: #ff9100; /* Disable hover effects on touch devices */
    color: white;
    border: none;
  }

  .input-field {
    -webkit-tap-highlight-color: transparent;
  }
}

.global-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.global-loader.show {
  display: flex;
  opacity: 1;
}

.loader {
  width: 50px;
  aspect-ratio: 1;
  display: grid;
}

.loader:before,
.loader:after {
  content: "";
  grid-area: 1/1;
  margin: 0 0 15px 15px;
  --c: #0000 calc(100% / 3), #046d8b 0 calc(2 * 100% / 3), #0000 0;
  --c1: linear-gradient(90deg, var(--c));
  --c2: linear-gradient(0deg, var(--c));
  background: var(--c1), var(--c2), var(--c1), var(--c2);
  background-size: 300% 4px, 4px 300%;
  background-repeat: no-repeat;
  animation: l12 1s infinite linear;
}

.loader:after {
  margin: 15px 15px 0 0;
  transform: scale(-1, -1);
}

@keyframes l12 {
  0% {
    background-position: 50% 0, 100% 100%, 0 100%, 0 0;
  }
  25% {
    background-position: 0 0, 100% 50%, 0 100%, 0 0;
  }
  50% {
    background-position: 0 0, 100% 0, 50% 100%, 0 0;
  }
  75% {
    background-position: 0 0, 100% 0, 100% 100%, 0 50%;
  }
  75.01% {
    background-position: 100% 0, 100% 0, 100% 100%, 0 50%;
  }
  100% {
    background-position: 50% 0, 100% 0, 100% 100%, 0 100%;
  }
}

body.loading {
  overflow: hidden;
}

/* Flip Animation Styles */
.flip-container {
  perspective: 1000px;
  width: 100%;
  max-width: 24rem;
  margin: 0 auto;
  position: relative;
  /* Remove fixed height to allow content to dictate size, but we need some height for absolute positioning to work relative to something */
  /* Actually, for flip to work with absolute children, parent needs height. 
     Let's use a min-height that fits the content */
  min-height: 480px;
}

.flip-container.flip .flipper {
  transform: rotateY(180deg);
}

.flipper {
  transition: 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-style: preserve-3d;
  position: relative;
  width: 100%;
  height: 100%;
}

.login-container.front,
.login-container.back {
  backface-visibility: hidden;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

.login-container.front {
  z-index: 2;
  transform: rotateY(0deg);
}

.login-container.back {
  transform: rotateY(180deg);
}

/* Adjust login-container for flip context */
.flip-container .login-container {
  animation: none;
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  background: #1e293b;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 12px;
  padding: 2rem;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  transform: scale(1);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.hidden .modal-content {
  transform: scale(0.9);
}

.modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-icon {
  font-size: 3rem;
  color: #3b82f6;
  margin-bottom: 1rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #fff;
}

.modal-body {
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 1rem;
}

.btn-modal {
  flex: 1;
  padding: 0.75rem;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-confirm {
  background: #3b82f6;
  color: #fff;
}

.btn-confirm:hover {
  background: #2563eb;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}
