/* ===== Modal ===== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.modal.active { display: flex; }

.modal-content {
  position: relative;
  background: linear-gradient(145deg, #fff, #f8f9fa);
  margin: 0;
  padding: 42px 30px 40px;
  width: 92%;
  max-width: 420px;
  border-radius: 24px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation: modalSlideIn 0.3s ease-out;
  border: 1px solid rgba(37, 211, 102, 0.2);
  box-sizing: border-box;
  overflow: visible;
}

@keyframes modalSlideIn {
  0%   { opacity: 0; transform: translate(-50%, -60%); }
  100% { opacity: 1; transform: translate(-50%, -50%); }
}

/* ===== Close Button ===== */
.close-button {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #9ca3af;
  transition: all 0.3s ease;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.close-button:hover {
  color: #4b5563;
  background-color: #f3f4f6;
  transform: rotate(90deg);
}

/* ===== Modal Title ===== */
.modal-title {
  text-align: center;
  font-size: 26px;
  line-height: 36px;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 28px;
  position: relative;
  padding-bottom: 15px;
  letter-spacing: -0.5px;
  background: linear-gradient(145deg, #25d366, #128c7e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.modal-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #25d366, #128c7e);
  border-radius: 2px;
}

/* ===== Timer ===== */
.timer {
  color: #ff3b30;
  font-weight: 600;
  text-align: center;
  margin-bottom: 28px;
  min-height: 56px;
  font-size: 18px;
  line-height: 26px;
  background: linear-gradient(145deg, #fff5f5, #fff);
  padding: 13px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 59, 48, 0.14);
  box-shadow: 0 4px 10px rgba(255, 59, 48, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== Phone Input ===== */
.phone-input {
  --tel-control-height: 48px;
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-bottom: 28px;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* ===== Country Selector ===== */
.country-selector {
  position: relative;
  width: 96px;
  max-width: 96px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}
.country-select-trigger {
  width: 100%;
  height: var(--tel-control-height);
  min-height: var(--tel-control-height);
  max-height: var(--tel-control-height);
  padding: 0 6px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 14px;
  line-height: 20px;
  background-color: #f9fafb;
  transition: all 0.3s ease;
  color: #1a1a1a;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: left;
  box-sizing: border-box;
}
.country-select-trigger:hover {
  border-color: #25d366;
}
.country-select-trigger:focus {
  border-color: #25d366;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
  background-color: #fff;
}
.country-select-flag-img {
  width: 22px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.country-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  line-height: 20px;
  margin-bottom: 6px;
  color: #1a1a1a;
  background-color: #f9fafb;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
  outline: none;
}
.country-search-input:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
  background-color: #fff;
}
.country-search-input::placeholder {
  color: #9ca3af;
}
.country-options-wrap {
  max-height: 230px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.country-option.hidden {
  display: none;
}

.country-select-menu {
  position: absolute;
  z-index: 1500;
  top: calc(100% + 6px);
  left: 0;
  width: 320px;
  max-height: 280px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  padding: 6px;
}
.country-option {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 26px 1fr auto 22px;
  column-gap: 10px;
  align-items: center;
  cursor: pointer;
  color: #1f2937;
}
.country-option:hover { background: #f3f4f6; }
.country-option.is-selected { background: #ecfdf5; }
.country-option.is-selected .country-option-check { display: block; }
.country-option-flag-img {
  width: 22px;
  height: 15px;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.country-option-name {
  font-size: 0.95em;
  color: #111827;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.country-option-dial {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.95em;
}
.country-option-check {
  display: none;
  color: #25d366;
  font-weight: 700;
  font-size: 1rem;
  justify-self: end;
}

/* ===== Phone Number Input ===== */
.phone-number {
  flex: 1;
  min-width: 0;
  align-self: stretch;
  height: var(--tel-control-height);
  min-height: var(--tel-control-height);
  max-height: var(--tel-control-height);
  padding: 0 12px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-size: 16px;
  line-height: 44px;
  transition: all 0.3s ease;
  color: #1a1a1a;
  font-weight: 500;
  width: 0;
  box-sizing: border-box;
}
.phone-number:focus {
  border-color: #25d366;
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
  background-color: #fff;
}

/* ===== Phone Error ===== */
.phone-error {
  display: none;
  text-align: center;
  color: #dc2626;
  font-size: 0.85em;
  font-weight: 500;
  margin-bottom: 16px;
  padding: 10px 14px;
  background: linear-gradient(145deg, #fef2f2, #fff5f5);
  border: 1px solid #fecaca;
  border-radius: 10px;
  line-height: 1.5;
  animation: errorShake 0.4s ease-out;
}
.phone-error.active { display: block; }
@keyframes errorShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ===== Login Button ===== */
.login-button {
  width: 100%;
  min-height: 56px;
  padding: 15px 14px;
  background: linear-gradient(145deg, #25d366, #128c7e);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 18px;
  line-height: 26px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}
.login-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.3);
}
.login-button:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.login-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.2);
}

/* ===== Verification Code ===== */
.verification-code-container {
  display: none;
  margin-top: 24px;
}
.verification-code-container.active { display: block; }

.verification-code-group {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 15px;
}
.verification-code-box {
  width: 35px;
  height: 45px;
  border: 2px solid #e5e7eb;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: 600;
  color: #1f2937;
  background-color: #f9fafb;
}

.risk-warning {
  background-color: #fff5f5;
  border: 1px solid #fecaca;
  color: #dc2626;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9em;
  line-height: 1.5;
}

/* ===== Copy Button ===== */
.copy-button {
  width: 100%;
  padding: 12px;
  background-color: #25d366;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 0.95em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 4px rgba(37, 211, 102, 0.2);
}
.copy-button:hover {
  background-color: #128c7e;
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(37, 211, 102, 0.3);
}
.copy-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(37, 211, 102, 0.2);
}
.copy-button.copied {
  background-color: #128c7e;
  animation: copySuccess 0.5s ease;
}
@keyframes copySuccess {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}

/* ===== Tutorial Link ===== */
.tutorial-link {
  color: #25d366;
  text-decoration: none;
  font-size: 0.9em;
  display: block;
  text-align: center;
}
.tutorial-link:hover { text-decoration: underline; }

/* ===== Loading ===== */
.loading-container {
  display: none;
  text-align: center;
  margin: 20px 0;
  position: relative;
  z-index: 2;
  height: 200px;
}
.loading-container.active { display: block; }

.loading-progress {
  width: 160px;
  height: 160px;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(37, 211, 102, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}
.loading-progress::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid #e5e7eb;
  box-sizing: border-box;
}
.loading-progress::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 3px solid transparent;
  border-top-color: #25d366;
  animation: spin 1s linear infinite;
  box-sizing: border-box;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== Polling Dot ===== */
.polling-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #25d366;
  animation: dotPulse 1.2s ease-in-out infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes dotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}
.loading-text {
  width: 120px;
  text-align: center;
  color: #4b5563;
  font-size: 0.95em;
  font-weight: 500;
  line-height: 1.4;
  position: relative;
  z-index: 3;
}
.loading-text.error {
  color: #dc2626;
  width: 160px;
}

/* ===== Success Modal ===== */
.success-modal { z-index: 1200; }
.success-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 4px 6px rgba(37, 211, 102, 0.2));
  animation: iconPop 0.5s ease-out;
}
@keyframes iconPop {
  0%   { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.success-title {
  color: #1a1a1a;
  font-size: 1.5em;
  font-weight: 700;
  margin-bottom: 15px;
  letter-spacing: -0.5px;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.success-message {
  color: #4a5568;
  margin-bottom: 20px;
  line-height: 1.6;
  font-size: 0.95em;
  padding: 0 10px;
}
.verification-info {
  font-size: 0.8em;
  color: #6b7280;
  margin-top: 15px;
  padding: 10px 12px;
  background: linear-gradient(145deg, #f8f9fa, #fff);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}
.verification-info::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #25d366, #128c7e);
}
.info-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding-left: 12px;
}
.info-label {
  min-width: 75px;
  text-align: left;
}
.verification-notice {
  font-size: 0.85em;
  color: #2d3748;
  padding: 12px 15px;
  background: linear-gradient(145deg, #f8f9fa, #fff);
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  position: relative;
  overflow: hidden;
}
.verification-notice::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, #f59e0b, #d97706);
}

/* ===== Tutorial Modal ===== */
.tutorial-modal { z-index: 1100; }
.tutorial-close-button {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #9ca3af;
  transition: color 0.3s ease;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.tutorial-close-button:hover { color: #4b5563; }
.tutorial-title {
  font-size: 1.2em;
  font-weight: 600;
  color: #1a1a1a;
  margin-bottom: 10px;
  text-align: center;
}
.tutorial-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
  margin-bottom: 15px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ===== Warning Modal ===== */
.warning-modal { z-index: 1300; }
.warning-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 59, 48, 0.1);
  border-radius: 50%;
  animation: warningPulse 2s infinite;
}
@keyframes warningPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.warning-icon svg {
  width: 32px;
  height: 32px;
  color: #ff3b30;
}
.warning-title {
  font-size: 1.3em;
  font-weight: 700;
  color: #1a1a1a;
  margin-bottom: 20px;
  text-align: center;
  position: relative;
  padding-bottom: 15px;
}
.warning-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 3px;
  background: #ff3b30;
  border-radius: 2px;
}
.warning-message {
  color: #4a5568;
  margin-bottom: 20px;
  line-height: 1.6;
  font-size: 1em;
  text-align: center;
  background: rgba(255, 59, 48, 0.05);
  border-radius: 8px;
  padding: 15px;
  border: 1px solid rgba(255, 59, 48, 0.1);
}

/* ===== Floating WhatsApp Button ===== */
.floating-wa-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #22c55e;
  color: #fff;
  padding: 16px;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: background-color 0.2s;
  z-index: 50;
  border: none;
  cursor: pointer;
}
.floating-wa-btn:hover { background-color: #16a34a; }

/* ===== Language Selector ===== */
.lang-selector {
  position: relative;
}
.lang-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
}
.lang-toggle-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.5);
  transform: rotate(20deg);
}
.lang-menu {
  position: absolute;
  z-index: 1600;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  max-height: 360px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.lang-search-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  line-height: 20px;
  margin-bottom: 6px;
  color: #1a1a1a;
  background-color: #f9fafb;
  transition: border-color 0.3s ease;
  box-sizing: border-box;
  outline: none;
  flex-shrink: 0;
}
.lang-search-input:focus {
  border-color: #25d366;
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1);
  background-color: #fff;
}
.lang-search-input::placeholder {
  color: #9ca3af;
}
.lang-options-wrap {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
}
.lang-option {
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  color: #1f2937;
  font-size: 14px;
  transition: background 0.2s;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 10px;
  align-items: center;
}
.lang-option:hover { background: #f3f4f6; }
.lang-option.is-selected {
  background: #ecfdf5;
  color: #25d366;
  font-weight: 600;
}
.lang-option.hidden { display: none; }
.lang-option-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lang-option-dial {
  color: #6b7280;
  font-weight: 600;
  font-size: 0.9em;
  flex-shrink: 0;
}

/* ===== Page-level overrides ===== */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}