/* Core & Reset Styles */
:root {
  --bg-dark: #19232d;
  --card-bg: #19232d;
  --input-bg: #141c24;
  --input-border: #283442;
  --input-focus-border: #0064e0;
  --text-main: #f0f2f5;
  --text-muted: #8290a0;
  --text-placeholder: #6a7888;
  --btn-primary-bg: #0064e0;
  --btn-primary-hover: #0056c6;
  --btn-secondary-border: #0064e0;
  --btn-secondary-text: #0084ff;
  --btn-secondary-hover-bg: rgba(0, 100, 224, 0.08);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font-family);
  -webkit-tap-highlight-color: transparent;
}

html, body {
  width: 100%;
  height: 100%;
  background-color: #0d131a;
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
}

/* App Viewport Container */
.app-viewport {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

@media (min-width: 480px) {
  .app-viewport {
    padding: 20px;
  }
}

/* Mobile Frame Container */
.mobile-container {
  width: 100%;
  max-width: 420px;
  height: 100%;
  max-height: 880px;
  background-color: var(--bg-dark);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

@media (min-width: 480px) {
  .mobile-container {
    height: 92vh;
    border-radius: 28px;
    border: 1px solid #232f3e;
  }
}

/* Header */
.app-header {
  height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: transparent;
  z-index: 10;
}

.icon-btn {
  background: none;
  border: none;
  color: #cfd8e3;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
}

.icon-btn:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.language-static {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 6px 12px;
}

.header-with-back {
  justify-content: space-between !important;
}

.overflow-scrollable {
  overflow-y: auto !important;
}

.text-center-link {
  text-decoration: none;
}

/* Main Content Area */
.login-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 0 24px 10px 24px;
  width: 100%;
}

/* Avatar Section */
.avatar-wrapper {
  position: relative;
  margin-top: 5px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avatar-img {
  width: 110px;
  height: 110px;
  object-fit: contain;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-img:hover {
  transform: scale(1.05) rotate(2deg);
}

/* Login Form */
.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.input-group {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}

.form-input {
  width: 100%;
  height: 54px;
  background-color: var(--input-bg);
  border: 1.2px solid var(--input-border);
  border-radius: 14px;
  padding: 0 16px;
  font-size: 15px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.form-input::placeholder {
  color: var(--text-placeholder);
  font-size: 14.5px;
}

.form-input:focus {
  border-color: var(--input-focus-border);
  background-color: #17222e;
}

.clear-btn, .toggle-password-btn {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.clear-btn:hover, .toggle-password-btn:hover {
  color: var(--text-main);
}

/* Primary Button */
.btn-primary {
  width: 100%;
  height: 48px;
  margin-top: 4px;
  background-color: var(--btn-primary-bg);
  color: #ffffff;
  border: none;
  border-radius: 24px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.btn-primary:hover {
  background-color: var(--btn-primary-hover);
}

.btn-primary:active {
  transform: scale(0.98);
}

/* Forgotten Password Link */
.forgot-password-container {
  display: flex;
  justify-content: center;
  margin-top: 10px;
}

.forgot-link {
  color: var(--text-main);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.forgot-link:hover {
  opacity: 0.85;
  text-decoration: underline;
}

/* App Footer */
.app-footer {
  padding: 10px 24px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.btn-secondary {
  width: 100%;
  height: 48px;
  background-color: transparent;
  color: var(--btn-secondary-text);
  border: 1.5px solid var(--btn-secondary-border);
  border-radius: 24px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}

.btn-secondary:hover {
  background-color: var(--btn-secondary-hover-bg);
}

.btn-secondary:active {
  transform: scale(0.98);
}

.bottom-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 4px 0 0 0;
  opacity: 1;
  z-index: 10;
}

.footer-logo-img {
  display: block;
  height: 72px;
  max-height: 95px;
  width: auto;
  max-width: 95%;
  object-fit: contain;
}

/* Spinner Animation */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.hidden {
  display: none !important;
}

.form-help {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.code-input {
  text-align: center;
  letter-spacing: 0.35em;
  font-size: 18px;
}

.link-button {
  align-self: center;
  border: 0;
  background: transparent;
  color: var(--btn-secondary-text);
  cursor: pointer;
  font-size: 14px;
  padding: 8px;
}

.home-content {
  justify-content: center;
  text-align: center;
}

.home-title {
  margin-bottom: 10px;
  font-size: 24px;
}

/* Modal Styles */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-card {
  width: 100%;
  background-color: #1e2a38;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  padding: 20px 24px;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 70vh;
  overflow-y: auto;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #2d3b4d;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text-main);
}

.close-modal-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
}

.lang-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.lang-list li {
  padding: 14px 12px;
  font-size: 15px;
  color: var(--text-main);
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.lang-list li:hover {
  background-color: rgba(255, 255, 255, 0.06);
}

.lang-list li.active {
  color: #0084ff;
  font-weight: 600;
  background-color: rgba(0, 100, 224, 0.12);
}

/* Toast Component */
.toast {
  position: absolute;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #2b394a;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 200;
  border: 1px solid #3d4f64;
  animation: toastPop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  text-align: center;
  max-width: 90%;
}

@keyframes toastPop {
  0% { transform: translate(-50%, -20px); opacity: 0; }
  100% { transform: translate(-50%, 0); opacity: 1; }
}
