/* BET30 Login & Register Modal Redesign */

/* Backdrop */
.login-modal {
  background: rgba(0, 0, 0, 0.85); /* Darker backdrop */
  backdrop-filter: blur(8px);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2147483647 !important; /* Max z-index to ensure it covers everything */
  display: none; /* Hidden by default */
  align-items: center;
  justify-content: center;
}

.login-modal.open {
  display: flex;
}

/* Modal Content Container */
.login-modal .login-content {
  background:
    radial-gradient(
      1200px 500px at 50% -20%,
      rgba(255, 255, 255, 0.08) 0%,
      rgba(255, 255, 255, 0) 60%
    ),
    linear-gradient(180deg, #0b1220 0%, #050a14 100%);
  border-radius: 16px;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.7);
  padding: 26px 24px 22px;
  width: 460px;
  max-width: 92vw;
  max-height: 95vh; /* Ensure it fits in viewport */
  overflow-y: auto; /* Allow scrolling on small screens */
  color: #fff;
  /* overflow: visible;  Removed to allow scrolling, decoration needs handling */
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Custom Scrollbar */
.login-modal .login-content::-webkit-scrollbar {
  width: 4px;
}
.login-modal .login-content::-webkit-scrollbar-track {
  background: transparent;
}
.login-modal .login-content::-webkit-scrollbar-thumb {
  background-color: #f07400;
  border-radius: 3px;
}

/* Liana Decoration (Top) - Adjusted to stay visible or be inside */
.modal-decoration-top {
  position: absolute;
  top: 0; /* Moved inside visually */
  left: 0;
  width: 100%;
  height: 40px; /* Reduced height */
  background-size: 100% auto;
  z-index: 15;
  pointer-events: none;
  opacity: 0.8;
}

/* Close Button */
.login-close {
  position: absolute;
  top: 10px; /* Moved inside */
  right: 10px; /* Moved inside */
  background: transparent;
  border: none;
  box-shadow: none;
  z-index: 20;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  font-size: 22px;
  line-height: 1;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition:
    filter 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
}

.login-close:hover {
  opacity: 1;
  filter: brightness(1.05);
  transform: scale(1.03);
}

/* Logo */
.login-modal .login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 4px 0 10px;
}
.login-modal .login-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.login-modal .login-logo img {
  width: 117px;
  height: 132px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.55));
}
.login-modal .login-brand-text {
  font-weight: 900;
  font-size: 26px;
  letter-spacing: 1px;
  color: #ff7a00;
  line-height: 1;
}

.login-modal .login-subtitle {
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  margin: 0 0 18px;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
}

/* Title */
.login-modal .login-title {
  font-family: "Oswald", sans-serif;
  color: #f07400;
  text-align: center;
  font-size: 22px; /* Reduced size */
  margin-bottom: 15px;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Form Inputs */
.login-modal .login-label {
  color: #e0e0e0;
  text-shadow: 0 1px 2px #000;
  font-family: "Oswald", sans-serif;
  letter-spacing: 1px;
  font-size: 13px; /* Slightly smaller */
  margin-bottom: 4px;
  display: block;
}

.login-modal .form-input {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 155, 41, 0.822);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.95);
  font-family: "Inter", sans-serif;
  padding: 14px 14px;
  margin-bottom: 12px; /* Compact margin */
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset;
  transition:
    border-color 0.2s,
    box-shadow 0.2s,
    background 0.2s;
  font-size: 14px;
}

.login-modal .form-input:focus {
  outline: none;
  border-color: #f07400;
  background: rgba(0, 0, 0, 0.22);
  box-shadow:
    0 0 0 1px rgba(242, 0, 141, 0.25),
    0 10px 24px rgba(0, 0, 0, 0.28);
}

.login-modal .form-input::placeholder {
  color: rgba(255, 255, 255, 0.42);
}

/* Custom Button (BET30 Style) */
.btn-login-custom {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 16px;
  background: #f07400;
  border: none;
  border-radius: 14px;
  color: #ffffff;
  font-family: "Oswald", sans-serif;
  font-weight: 800;
  font-size: 16px;
  text-transform: uppercase;
  cursor: pointer;
  margin-top: 6px;
  transition:
    transform 0.1s,
    filter 0.2s,
    opacity 0.2s;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.45);
}

.btn-login-custom:hover {
  filter: brightness(1.1);
  transform: translateY(-2px);
}

.btn-login-custom:active {
  transform: translateY(1px);
  filter: brightness(0.98);
}

/* Helper elements within button - kept for structure compatibility but hidden if using CSS only */
.btn-login-custom .btn-l,
.btn-login-custom .btn-r {
  display: none;
}
.btn-login-custom .btn-c {
  background: none;
  width: auto;
  flex-grow: 0;
}

/* Meta Links */
.login-modal .login-meta {
  color: #bbb;
  font-size: 12px; /* Slightly smaller */
  margin-bottom: 10px; /* Reduced margin */
  text-align: center;
}

.login-modal .login-meta a {
  color: #f07400;
  text-decoration: none;
  font-weight: 700;
}

.login-modal .login-meta a:hover {
  text-decoration: underline;
}

/* Password Toggle */
.login-modal .password-wrap {
  position: relative;
  width: 100%;
}
.login-modal .password-toggle {
  position: absolute;
  right: 10px;
  top: 14px;
  background: none;
  border: none;
  color: #f07400;
  cursor: pointer;
  font-size: 1.2em;
}

/* Checkbox Style Override */
.login-modal input[type="checkbox"] {
  accent-color: #f07400;
}

#loginModal .login-content.auth-login {
  width: 850px;
  max-width: 96vw;
  padding: 0;
  overflow: hidden;
  background: url("/media/casa_media/assets/auth-back.webp") center/cover
    no-repeat;
  border: 1px solid rgba(255, 255, 255, 0.14);
}
#loginModal .login-content.auth-login::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(
      900px 520px at 18% 50%,
      rgba(0, 0, 0, 0.08) 0%,
      rgba(0, 0, 0, 0.55) 70%,
      rgba(0, 0, 0, 0.78) 100%
    ),
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.1) 0%,
      rgba(0, 0, 0, 0.55) 58%,
      rgba(0, 0, 0, 0.78) 100%
    );
  pointer-events: none;
}
#loginModal .auth-login-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 400px;
}
#loginModal .auth-visual {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 24px 12px 24px 34px;
}
#loginModal .auth-cat {
  width: 100%;
  height: auto;
  max-height: 360px;
  object-fit: contain;
  object-position: left center;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
}
#loginModal .auth-form-area {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 34px 54px 34px 42px;
  gap: 14px;
  align-items: center;
}
#loginModal .auth-title {
  font-weight: 900;
  font-size: 28px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 8px;
  text-align: center;
  width: 100%;
}
#loginModal .auth-label {
  font-weight: 800;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 8px;
}
#loginModal .auth-login .login-form {
  width: 360px;
  max-width: 100%;
}
#loginModal .auth-login .login-form {
  gap: 14px;
}
#loginModal .auth-login .input-group {
  margin: 0;
}
#loginModal .auth-login .form-input {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 0;
}
#loginModal .auth-login .form-input:focus {
  border-color: rgba(255, 255, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(255, 226, 122, 0.18);
}
#loginModal .auth-login .password-toggle {
  color: rgba(255, 255, 255, 0.85);
  top: 46px;
  right: 12px;
}
#loginModal .auth-login .btn-login-custom {
  width: 240px;
  margin: 12px auto 0;
  background: linear-gradient(180deg, #f6de87 0%, #d9a834 55%, #a96f10 100%);
  color: #06231d;
  border-radius: 12px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  opacity: 0.92;
}
#loginModal .auth-login .btn-login-custom:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  opacity: 1;
}
#loginModal .auth-login .login-error {
  margin-top: 6px;
}

.auth-mobile-bar {
  display: none;
}

@media (max-width: 900px) {
  #loginModal.login-modal {
    align-items: stretch;
    justify-content: stretch;
  }
  #loginModal .login-content.auth-login {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }
  #loginModal .login-content.auth-login::before {
    background: linear-gradient(
      180deg,
      rgba(0, 0, 0, 0.28) 0%,
      rgba(0, 58, 41, 0.55) 38%,
      rgba(0, 37, 28, 0.92) 75%,
      rgba(0, 26, 20, 0.96) 100%
    );
  }
  #loginModal .auth-login-grid {
    display: flex;
    flex-direction: column;
    height: 100%;
  }
  #loginModal .auth-visual {
    display: flex;
    justify-content: center;
    padding: calc(56px + env(safe-area-inset-top)) 18px 18px;
  }
  #loginModal .auth-visual::after {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 12px;
    text-align: center;
    font-weight: 900;
    font-size: clamp(34px, 10vw, 52px);
    letter-spacing: 1px;
    color: rgba(235, 255, 170, 0.95);
    text-shadow:
      0 2px 0 rgba(0, 0, 0, 0.35),
      0 0 10px rgba(165, 255, 110, 0.35),
      0 0 18px rgba(165, 255, 110, 0.28);
    pointer-events: none;
  }
  #loginModal .auth-cat {
    max-height: 260px;
    object-position: center;
  }
  #loginModal .auth-form-area {
    padding: 14px 18px calc(24px + env(safe-area-inset-bottom));
    align-items: stretch;
    justify-content: flex-start;
    background: rgba(0, 34, 26, 0.55);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    flex: 1;
    overflow: auto;
  }
  #loginModal .auth-title {
    display: none;
  }
  #loginModal .auth-login .btn-login-custom {
    width: min(360px, 100%);
    margin: 14px auto 0;
  }
  #loginModal .auth-login .password-toggle {
    top: 46px;
  }
  #loginModal .login-close-desktop {
    display: none;
  }
  #loginModal .auth-mobile-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    position: absolute;
    top: calc(10px + env(safe-area-inset-top));
    left: 12px;
    right: 12px;
    z-index: 3;
    color: rgba(255, 255, 255, 0.92);
  }
  #loginModal .auth-back {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: inherit;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    padding: 0;
  }
  #loginModal .auth-mobile-heading {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.2px;
    text-transform: none;
  }
  #loginModal .auth-login .login-form {
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
  }
}
