/* -------------------------------------------------------------
   AUTH MODAL (Login & Register)
------------------------------------------------------------- */
.auth-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.auth-modal.active {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1;
}

.modal-container {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: rgba(15, 23, 42, 0.98);
  border: 1.5px solid rgba(255, 170, 0, 0.35);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(255, 170, 0, 0.2);
  z-index: 2;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.auth-modal.active .modal-container {
  transform: scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.2s ease;
  z-index: 10;
}

.modal-close:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.modal-content {
  padding: 32px 28px 28px;
}

.modal-logo {
  text-align: center;
  margin-bottom: 16px;
}

.modal-logo img {
  height: 50px;
  width: auto;
  filter: drop-shadow(0 4px 12px rgba(255, 170, 0, 0.3));
}

.modal-title {
  font-family: 'Baloo 2', 'Cinzel', cursive, sans-serif;
  font-size: 26px;
  font-weight: 800;
  text-align: center;
  color: #fff;
  margin-bottom: 6px;
  text-shadow: 0 2px 10px rgba(255, 170, 0, 0.3);
}

.modal-subtitle {
  font-size: 13px;
  text-align: center;
  color: #94a3b8;
  margin-bottom: 22px;
  font-weight: 500;
}

/* Auth Form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label i {
  font-size: 12px;
  color: #f59e0b;
}

.form-input {
  width: 100%;
  padding: 11px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1.5px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.25s ease;
  font-family: 'Be Vietnam Pro', 'Outfit', sans-serif;
}

.form-input::placeholder {
  color: #64748b;
}

.form-input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: #ffcc00;
  box-shadow: 0 0 0 3px rgba(255, 204, 0, 0.1);
}

/* Validation States */
.form-input.is-invalid {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.06);
}

.form-input.is-invalid:focus {
  border-color: #f87171 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.25) !important;
}

.form-input.is-valid {
  border-color: #10b981 !important;
  background: rgba(16, 185, 129, 0.04);
}

.form-input.is-valid:focus {
  border-color: #34d399 !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2) !important;
}

.field-error {
  display: none;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #f87171;
  font-weight: 500;
  margin-top: 2px;
  line-height: 1.4;
  animation: fadeInError 0.2s ease-in-out;
}

.field-error.show {
  display: flex;
}

.field-error i {
  font-size: 11px;
  flex-shrink: 0;
}

@keyframes fadeInError {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Password Strength Meter (Ẩn mặc định, chỉ hiện khi đang focus nhập mật khẩu) */
.password-meter-wrap {
  margin-top: 4px;
  display: none;
  flex-direction: column;
  gap: 4px;
  animation: fadeInError 0.2s ease-in-out;
}

.form-group:focus-within .password-meter-wrap.show {
  display: flex;
}

.password-meter-bar {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
}

.password-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.password-meter-fill.weak {
  width: 33%;
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

.password-meter-fill.medium {
  width: 66%;
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.password-meter-fill.strong {
  width: 100%;
  background: #10b981;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
}

.password-meter-text {
  font-size: 11px;
  font-weight: 600;
  text-align: right;
  color: #94a3b8;
  transition: color 0.3s ease;
}

.password-meter-text.weak {
  color: #ef4444;
}

.password-meter-text.medium {
  color: #f59e0b;
}

.password-meter-text.strong {
  color: #10b981;
}

/* Button Shake on Form Error */
@keyframes shakeForm {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.btn-shake {
  animation: shakeForm 0.4s ease;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .form-input {
  padding-right: 44px;
}

.input-icon-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: #64748b;
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  transition: color 0.2s ease;
}

.input-icon-btn:hover {
  color: #cbd5e1;
}

.form-hint {
  display: none;
  font-size: 11.5px;
  color: #94a3b8;
  margin-top: 2px;
  line-height: 1.4;
  animation: fadeInError 0.2s ease-in-out;
}

/* Chỉ hiển thị gợi ý khi ô input trong nhóm đang được focus và chưa có lỗi */
.form-group:focus-within .form-hint {
  display: block;
}

/* Khi trường gặp lỗi, ẩn gợi ý hoàn toàn để nhường chỗ cho field-error */
.form-group.has-error .form-hint {
  display: none !important;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -4px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: #cbd5e1;
  cursor: pointer;
  user-select: none;
}

.checkbox-label input[type="checkbox"] {
  display: none;
}

.checkbox-custom {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  position: relative;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: #ff7700;
  border-color: #ff7700;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 9px;
}

.form-link {
  color: #ffcc00;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  transition: color 0.2s ease;
}

.form-link:hover {
  color: #ff7700;
  text-decoration: underline;
}

.btn-submit {
  width: 100%;
  padding: 12px 24px;
  background: linear-gradient(135deg, #ff7b00 0%, #ea580c 100%);
  border: 2px solid #ffa040;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 20px rgba(255, 85, 0, 0.4);
  transition: all 0.3s ease;
  margin-top: 4px;
}

.btn-submit:hover {
  background: linear-gradient(135deg, #ff9100 0%, #ff5722 100%);
  box-shadow: 0 8px 28px rgba(255, 100, 0, 0.6);
  transform: translateY(-2px);
}

.btn-submit:active {
  transform: translateY(0);
}

.modal-footer {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.modal-footer p {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
}

.link-btn {
  background: none;
  border: none;
  color: #ffcc00;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  transition: color 0.2s ease;
  font-family: inherit;
  font-size: inherit;
}

.link-btn:hover {
  color: #ff7700;
  text-decoration: underline;
}

/* Responsive for Modal */
@media (max-width: 640px) {
  .modal-content {
    padding: 32px 24px 24px;
  }

  .modal-title {
    font-size: 24px;
  }

  .modal-logo img {
    height: 48px;
  }
}

/* -------------------------------------------------------------
   TERMS & CONDITIONS MODAL
------------------------------------------------------------- */
.modal-container.terms-modal-container {
  max-width: 680px;
}

.terms-scroll-body {
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 12px;
  margin: 18px 0;
  text-align: left;
}

.terms-scroll-body::-webkit-scrollbar {
  width: 6px;
}

.terms-scroll-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}

.terms-scroll-body::-webkit-scrollbar-thumb {
  background: rgba(255, 170, 0, 0.4);
  border-radius: 4px;
}

.terms-scroll-body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 170, 0, 0.7);
}

.terms-item {
  margin-bottom: 20px;
}

.terms-item:last-child {
  margin-bottom: 0;
}

.terms-item-title {
  font-size: 15px;
  font-weight: 700;
  color: #f59e0b;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.terms-item-desc {
  font-size: 13.5px;
  color: #cbd5e1;
  line-height: 1.65;
  margin: 0;
}

.terms-item-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.terms-item-list li {
  position: relative;
  padding-left: 20px;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.55;
}

.terms-item-list li::before {
  content: "•";
  position: absolute;
  left: 6px;
  top: 0;
  color: #f59e0b;
  font-size: 16px;
}

.terms-badge-notice {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 14px;
  border-radius: 8px;
  color: #fca5a5;
  font-size: 12.5px;
  line-height: 1.5;
  margin-top: 8px;
}
