/* ── Popup Overlay ─────────────────────────────────────────────────────────── */
.tw-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
  padding: 16px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

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

/* ── Popup Box ─────────────────────────────────────────────────────────────── */
.tw-popup-box {
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px 36px;
  width: 100%;
  max-width: 480px;
  position: relative;
  transform: translateY(30px) scale(0.97);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  max-height: 90vh;
  overflow-y: auto;
}

.tw-popup-overlay.tw-active .tw-popup-box {
  transform: translateY(0) scale(1);
}

/* ── Close Button ──────────────────────────────────────────────────────────── */
.tw-popup-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 26px;
  line-height: 1;
  color: #888;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}
.tw-popup-close:hover {
  color: #222;
  background: #f0f0f0;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.tw-popup-header {
  margin-bottom: 24px;
}
.tw-popup-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: #111;
  margin: 0 0 6px;
  letter-spacing: -0.3px;
}
.tw-popup-header p {
  font-size: 14px;
  color: #666;
  margin: 0;
}

/* ── Form Fields ───────────────────────────────────────────────────────────── */
.tw-form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
}

.tw-form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}

.tw-required {
  color: #e53935;
}

.tw-form-group input {
  padding: 11px 14px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  color: #222;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: #fafafa;
  font-family: inherit;
}

.tw-form-group input:focus {
  border-color: #111;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(17, 17, 17, 0.08);
}

.tw-form-group input.tw-input-error {
  border-color: #e53935;
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.1);
}

.tw-error {
  font-size: 12px;
  color: #e53935;
  margin-top: 4px;
  min-height: 16px;
}

/* ── Submit Button ─────────────────────────────────────────────────────────── */
.tw-submit-btn {
  width: 100%;
  padding: 13px;
  background: #111;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.2s, transform 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  letter-spacing: 0.2px;
}

.tw-submit-btn:hover:not(:disabled) {
  background: #333;
  transform: translateY(-1px);
}

.tw-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

/* ── Button Loader ─────────────────────────────────────────────────────────── */
.tw-btn-loader {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tw-spin 0.7s linear infinite;
  display: none;
}

.tw-submit-btn.tw-loading .tw-btn-loader {
  display: block;
}

.tw-submit-btn.tw-loading .tw-btn-text {
  opacity: 0.8;
}

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

/* ── Success / Error Message ───────────────────────────────────────────────── */
.tw-form-msg {
  margin-top: 14px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  display: none;
  text-align: center;
}

.tw-form-msg.tw-success {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #c8e6c9;
  display: block;
}

.tw-form-msg.tw-error-msg {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ffcdd2;
  display: block;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 520px) {
  .tw-popup-box {
    padding: 32px 20px 28px;
  }
  .tw-popup-header h2 {
    font-size: 19px;
  }
}
