/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  height: -webkit-fill-available;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: white;
  color: #333;
  overflow-x: hidden;
}

/* Login Container */
.wrapper {
  display: grid;
  grid-template-columns: 1fr 480px 1fr;
  background-image: url('/assets/images/desktop-bg.jpg');
  background-repeat: no-repeat;
  background-size: cover;
  /* align-items: center; */
}

@media (max-width: 480px) {
  .wrapper {
    grid-template-columns: 1fr;
  }

   .form-container {
                max-height: calc(100vh - 80px);
            }
}

.login-container {
  min-height: 100vh;
  min-height: 100dvh;
  min-height: 100svh;
  /* background-image: url('https://bigwin9.sgp1.cdn.digitaloceanspaces.com/banners/sky-bd-login.png'); */
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  position: relative;
  display: flex;
  flex-direction: column;
}

/* Back Button */
.back-button {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 10;
}

.back-button a {
  text-decoration: none;
  color: inherit;
}

.back-icon {
  width: 40px;
  height: 40px;
  background: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.back-icon:hover {
  transform: scale(1.05);
}

.back-icon i {
  color: black;
  font-size: 20px;
}

/* Login Form Section */
.login-form-section {
  background: white;
  border-radius: 20px 20px 0 0;
  width: 100%;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50vh;
  overflow-y: auto;
  box-shadow: 0px -11px 46px -14px rgba(0, 0, 0, 0.75);
}

@media (min-width: 768px) {
  .login-form-section {
    height: 50vh;
  }
}

/* Form Container */
.form-container {
  padding: 16px;
  max-width: 400px;
  margin: 0 auto;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .form-container {
    padding: 32px;
  }
}

/* Form Title */
.form-title {
  font-size: 2rem;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 16px;
  font-weight: 600;
}

@media (min-width: 768px) {
  .form-title {
    margin-bottom: 32px;
  }
}

/* Form */
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Input Groups */
.input-group {
  width: 100%;
}

.input-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.validation-wrapper {
  align-items: center;
}

/* Input Icons */
.input-icon {
  font-size: 25px;
  color: #9cb1bd;
  margin-top: 16px;
  transition: color 0.2s ease;
}

.input-icon.focused {
  color: #c0a024;
}

/* Input Container */
.input-container {
  flex: 1;
  position: relative;
}

.validation-container {
  position: relative;
}

/* Form Inputs */
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #6f8898;
  border-radius: 4px;
  background: white;
  font-size: 16px;
  transition: all 0.2s ease;
  outline: none;
}

/* Validation Code Input - extra right padding for the code display */
#validationCode {
  padding-right: 80px;
}

/* Hide number input spinner arrows */
#validationCode::-webkit-outer-spin-button,
#validationCode::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#validationCode[type='number'] {
  -moz-appearance: textfield;
}

.form-input:focus {
  border-color: #c0a024;
  box-shadow: none;
  outline: none;
}

/* Input Labels */
.input-label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  padding: 0 4px;
  color: #6f8898;
  font-size: 14px;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 1;
}

/* Label animation only when focused */
.form-input:focus + .input-label {
  top: 0;
  transform: translateY(-50%) scale(0.85);
  color: #c0a024;
}

/* Label animation when input has content (controlled by JavaScript) */
.form-input.has-content + .input-label {
  top: 0;
  transform: translateY(-50%) scale(0.85);
  color: #c0a024;
}

/* Password Toggle */
.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: #6f8898;
  font-size: 20px;
  padding: 4px;
  outline: none;
}

.password-toggle:focus {
  outline: none;
}

/* Validation Code Display */
.validation-code-display {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: white;
  padding: 4px 8px;
  font-size: 24px;
  font-weight: bold;
  color: #333;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  z-index: 2;
}

.validation-container:hover .validation-code-display,
.validation-container.focused .validation-code-display {
  background: #f4f4f5;
}

/* Checkbox Container */
.checkbox-container {
  display: flex;
  justify-content: center;
  margin: 0 48% 5% 0;;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.checkbox-input {
  display: none;
}

.checkbox-custom {
  width: 16px;
  height: 16px;
  border: 2px solid #6f8898;
  border-radius: 2px;
  margin-right: 8px;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-input:checked + .checkbox-custom {
  background: #ffd700;
  border-color: #ffd700;
}

.checkbox-input:checked + .checkbox-custom::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: black;
  font-size: 10px;
  font-weight: bold;
}

.checkbox-label {
  font-size: 12px;
  color: #889daa;
}

@media (min-width: 768px) {
  .checkbox-label {
    font-size: 14px;
  }
}

/* Submit Button */
.submit-button {
  background: #ffd700;
  color: black;
  border: none;
  border-radius: 4px;
  padding: 12px 64px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  align-self: center;
  position: relative;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-button:hover {
  background: #e6c200;
  transform: translateY(-1px);
}

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

.submit-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.button-text {
  transition: opacity 0.2s ease;
}

.submit-button.loading .button-text {
  opacity: 0;
}

/* Loading Spinner */
.loading-spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid #ffffff;
  border-top: 2px solid #ffd700;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
  background: #fee;
  border: 1px solid #fcc;
  border-radius: 4px;
  padding: 12px;
  margin-top: 16px;
  text-align: center;
}

.error-message span {
  color: #c33;
  font-size: 14px;
}

/* Debug Info */
.debug-info {
  background: #f0f0f0;
  border-radius: 4px;
  padding: 8px;
  margin-top: 16px;
  text-align: center;
}

.debug-info p {
  font-size: 12px;
  color: #666;
}

/* Mobile Specific Styles */
@media (max-width: 640px) {
  .login-container {
    min-height: calc(100vh - env(safe-area-inset-bottom));
    min-height: calc(100svh - env(safe-area-inset-bottom));
  }

  .logo-section {
    display: none;
  }

  .login-form-section {
    height: 50vh;
    height: 50dvh;
    height: 50svh;
  }

  .form-input {
    font-size: 16px !important;
  }

  .form-input:focus {
    font-size: 16px !important;
    transform: scale(1) !important;
  }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
  .login-container {
    min-height: -webkit-fill-available;
  }

  .login-form-section {
    height: 50vh;
    height: 50dvh;
  }
}

/* Prevent zoom on iOS */
@media screen and (max-width: 768px) {
  input[type='text'],
  input[type='password'],
  input[type='number'] {
    font-size: 16px !important;
    transform: scale(1) !important;
  }

  input:focus {
    font-size: 16px !important;
    transform: scale(1) !important;
  }
}

/* Hide scrollbar but allow scrolling */
.login-form-section::-webkit-scrollbar {
  display: none;
}

.login-form-section {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Custom focus styles */
.form-input:focus {
  outline: none !important;
  border: 1px solid #c0a024 !important;
  box-shadow: none !important;
}

/* Animation for label movement - handled above */

/* Safe area utilities */
.pb-safe {
  padding-bottom: env(safe-area-inset-bottom, 1rem);
}

.pt-safe {
  padding-top: env(safe-area-inset-top, 0);
}
