/* ==== Cấu hình màu và font ==== */
:root {
  --background-color: #f5f5f7;
  --card-bg: #ffffff;
  --primary-color: #245ff2;
  --text-primary: #1d1d1f;
  --text-muted: #86868b;
  --border-color: #d2d2d7;
  --success-color: #16a34a;
  --success-bg: #f0fdf4;
  --error-color: #dc2626;
  --error-bg: #fff5f5;
  --hover-bg: #f5f5f7;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
}

/* ==== Reset & Layout ==== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

/* ==== Card ==== */
.card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 24px;
  padding: 40px 32px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  opacity: 0;
  animation: fadeIn 0.6s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==== Logo & Header ==== */
.logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.logo img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 14px;
}

h1 {
  font-size: 26px;
  font-weight: 600;
  background: linear-gradient(90deg, #0084ff 15%, #ff6600 50%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 70px rgba(255, 159, 64, 0.9);
  margin-bottom: 4px;
}

.lead {
  color: var(--text-muted);
  font-size: 15px;
}

/* ==== Form ==== */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
  background-color: #ffffff;
}

.password-wrap {
  position: relative;
}

.password-input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: #8a8a90;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 8px;
  transition: color 0.2s ease, background 0.2s ease;
}

.toggle-password:hover {
  color: #007aff;
  background: rgba(0, 122, 255, 0.1);
}

.toggle-password:focus-visible {
  outline: 2px solid rgba(36, 95, 242, 0.5);
  outline-offset: 1px;
}

.icon-eye {
  width: 20px;
  height: 20px;
}

input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(36, 95, 242, 0.1);
}

/* ==== Error Message ==== */
.error {
  color: var(--error-color);
  font-size: 13px;
  margin-top: 6px;
  padding: 8px 12px;
  background-color: var(--error-bg);
  border-radius: 6px;
  border: 1px solid #fee2e2;
}

/* ==== Forgot Password ==== */
.forgot-password {
  text-align: right;
  margin-bottom: 20px;
  margin-top: -10px;
}

.forgot-password a {
  color: var(--primary-color);
  font-size: 14px;
  text-decoration: none;
  transition: opacity 0.2s ease;
}

.forgot-password a:hover {
  text-decoration: underline;
}

/* ==== Button ==== */
.btn-primary {
  width: 100%;
  padding: 13px 20px;
  background: var(--primary-color);
  color: #ffffff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

.btn-primary:hover {
  background: #1b47b5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(36, 95, 242, 0.3);
}

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

.btn-primary:disabled {
  cursor: pointer;
  opacity: 0.9;
}

.btn-label {
  transition: opacity 0.2s ease;
}

.btn-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  position: absolute;
  opacity: 0;
  pointer-events: none;
  animation: buttonSpin 0.7s linear infinite;
}

.btn-primary.is-loading .btn-label {
  opacity: 0;
}

.btn-primary.is-loading .btn-spinner {
  opacity: 1;
}

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

/* ==== reCAPTCHA ==== */
.g-recaptcha {
  display: flex;
  justify-content: center;
  margin: 20px 0;
}

/* ==== Divider ==== */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0;
}

.divider div {
  flex: 1;
  height: 1px;
  background-color: #e5e7eb;
}

.divider span {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

/* ==== Google Button ==== */
.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background-color: #fff;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 15px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s ease;
  font-weight: 500;
}

.google-btn:hover {
  background-color: var(--hover-bg);
  border-color: #c1c1c6;
}

.google-btn img,
.google-btn svg {
  width: 20px;
  height: 20px;
}

#g_id_onload, #googleBtn {
  display: none !important;
}

/* ==== Bottom Link ==== */
.muted {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  margin-top: 24px;
}

.muted a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.muted a:hover {
  text-decoration: underline;
}

/* ==== POPUP - PHONG CÁCH APPLE ==== */
.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.active {
  opacity: 1;
  visibility: visible;
}

.popup-content {
  background: #ffffff;
  border-radius: 20px;
  padding: 32px;
  width: 90%;
  max-width: 450px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup-overlay.active .popup-content {
  transform: scale(1);
}

.popup-content h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
  text-align: center;
}

.popup-content > p {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 24px;
  line-height: 1.5;
}

.popup-content input[type="email"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  margin-bottom: 16px;
}

.popup-content input[type="email"]:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(36, 95, 242, 0.1);
}

/* ==== Thông báo ==== */
.error-message,
.success-message {
  display: none;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
  text-align: center;
  line-height: 1.4;
}

.error-message {
  background-color: var(--error-bg);
  color: var(--error-color);
  border: 1px solid #fee2e2;
}

.success-message {
  background-color: var(--success-bg);
  color: var(--success-color);
  border: 1px solid #dcfce7;
}

/* ==== Popup Buttons ==== */
.popup-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.popup-buttons button {
  flex: 1;
  padding: 11px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

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

.btn-cancel:hover {
  background-color: #e8e8ed;
}

.btn-send {
  background-color: var(--primary-color);
  color: #ffffff;
}

.btn-send:hover {
  background-color: #1b47b5;
}

.btn-send:disabled {
  background-color: var(--border-color);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

/* ==== Footer ==== */
.footer {
  text-align: center;
  margin-top: 20px;
  padding: 0 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
  width: 100%;
  max-width: 420px;
}

/* ==== Responsive ==== */
@media (max-width: 480px) {
  body {
    padding: 30px;
  }

  .card {
    padding: 32px 24px;
  }

  h1 {
    font-size: 22px;
  }

  .logo img {
    width: 48px;
    height: 48px;
  }

  .popup-content {
    padding: 24px;
    max-width: 340px;
  }

  .popup-content h2 {
    font-size: 18px;
  }

  .footer {
    font-size: 12px;
    margin-top: 24px;
    padding-top: 20px;
  }
}
