/* static/css/components/private-placement-modal.css */

/* ── Overlay + wrapper ──────────────────────────────────────────────── */
.pp-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.pp-modal.active {
  display: flex;
}

.pp-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 5, 72, 0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

/* ── Sheet (the white card) ─────────────────────────────────────────── */
.pp-modal__sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 36px;
  width: 847px;
  max-width: 100%;
  max-height: 90vh;
  padding: 40px 30px;
  border-radius: 25px;
  background: #fff;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(4, 5, 72, 0.18);
}

/* ── Close button ───────────────────────────────────────────────────── */
.pp-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.15s;
}

.pp-modal__close:hover {
  background: #f1f5f9;
}

/* ── Header ─────────────────────────────────────────────────────────── */
.pp-modal__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  align-self: stretch;
}

.pp-modal__title {
  color: #040548;
  font-family: Inter, sans-serif;
  font-size: 22px;
  font-weight: 600;
  line-height: normal;
  margin: 0;
}

.pp-modal__desc {
  color: #334155;
  font-family: Poppins, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
  margin: 0;
}

/* ── Form ────────────────────────────────────────────────────────────── */
.pp-modal__form {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-self: stretch;
  width: 100%;
}

/* ── Field ───────────────────────────────────────────────────────────── */
.pp-modal__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pp-modal__label {
  color: #040548;
  font-family: Poppins, sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: normal;
}

.pp-modal__input {
  display: flex;
  height: 58px;
  padding: 16px;
  align-items: center;
  align-self: stretch;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  font-family: Poppins, sans-serif;
  font-size: 15px;
  color: #040548;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
  box-sizing: border-box;
}

.pp-modal__input:focus {
  border-color: #040548;
}

.pp-modal__input.pp-modal__select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23334155' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 44px;
  cursor: pointer;
}

/* ── Row (email + phone side by side) ───────────────────────────────── */
.pp-modal__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* ── Radio grid (2 × 2 for investment range) ─────────────────────────── */
.pp-modal__radio-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Radio pair (Yes / No for roundtable) ────────────────────────────── */
.pp-modal__radio-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Radio option shared styles ──────────────────────────────────────── */
.pp-modal__radio-option {
  cursor: pointer;
}

.pp-modal__radio-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.pp-modal__radio-box {
  display: flex;
  height: 58px;
  padding: 16px;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: #f8fafc;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  font-weight: 400;
  color: #334155;
  transition: border-color 0.2s, background 0.2s;
  user-select: none;
}

.pp-modal__radio-option input[type="radio"]:checked + .pp-modal__radio-box {
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: #f0f9ff;
  color: #040548;
  font-weight: 500;
}

/* Roundtable radio boxes — green border when selected */
.pp-modal__radio-option--roundtable input[type="radio"]:checked + .pp-modal__radio-box {
  border: 2px solid #008000;
  background: #f0fdf4;
  color: #040548;
}

/* Unselected roundtable boxes */
.pp-modal__radio-option--roundtable .pp-modal__radio-box {
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: #f8fafc;
}

/* ── Hint text ────────────────────────────────────────────────────────── */
.pp-modal__hint {
  color: #334155;
  font-family: Poppins, sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: normal;
  margin: 0;
}

/* ── Input error / valid states ──────────────────────────────────────── */
.pp-modal__input.has-error {
  border-color: #dc2626 !important;
  background: #fff8f8;
}

.pp-modal__input.is-valid {
  border-color: #16a34a !important;
}

/* ── Phone field container ────────────────────────────────────────────── */
.pp-phone-field {
  position: relative;
  display: flex;
  align-items: center;
  height: 58px;
  border-radius: 12px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  background: #fff;
  transition: border-color 0.2s;
  overflow: visible; /* dropdown escapes */
}

.pp-phone-field:focus-within {
  border-color: #040548;
}

.pp-phone-field.has-error {
  border-color: #dc2626 !important;
  background: #fff8f8;
}

.pp-phone-field.is-valid {
  border-color: #16a34a !important;
}

/* Country selector button */
.pp-phone-country {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 12px 0 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.pp-phone-flag {
  font-size: 18px;
  line-height: 1;
}

.pp-phone-dial {
  font-family: Poppins, sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #040548;
}

.pp-phone-caret {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.pp-phone-country[aria-expanded="true"] .pp-phone-caret {
  transform: rotate(180deg);
}

/* Divider between selector and input */
.pp-phone-divider {
  width: 1px;
  height: 28px;
  background: rgba(226, 232, 240, 0.98);
  flex-shrink: 0;
}

/* Number input (no border — field wrapper handles it) */
.pp-phone-number {
  flex: 1;
  height: 100%;
  padding: 0 14px;
  border: none;
  background: transparent;
  font-family: Poppins, sans-serif;
  font-size: 15px;
  color: #040548;
  outline: none;
  min-width: 0;
}

.pp-phone-number::placeholder {
  color: #94a3b8;
}

/* ── Country dropdown ─────────────────────────────────────────────────── */
.pp-phone-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 10200;
  width: 300px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.98);
  box-shadow: 0 12px 40px rgba(4, 5, 72, 0.14);
  overflow: hidden;
}

.pp-phone-dropdown.open {
  display: flex;
  flex-direction: column;
}

/* Search row */
.pp-phone-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid #f1f5f9;
}

.pp-phone-search {
  flex: 1;
  border: none;
  outline: none;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  color: #040548;
  background: transparent;
}

.pp-phone-search::placeholder {
  color: #94a3b8;
}

/* Scrollable country list */
.pp-phone-list {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #e2e8f0 transparent;
}

.pp-phone-list::-webkit-scrollbar { width: 4px; }
.pp-phone-list::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 4px; }

/* Individual country item */
.pp-phone-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background 0.12s;
}

.pp-phone-list li:hover,
.pp-phone-list li.pp-phone-item--active {
  background: #f0f9ff;
}

.pp-phone-item-flag {
  font-size: 16px;
  line-height: 1;
  width: 22px;
  text-align: center;
}

.pp-phone-item-name {
  flex: 1;
  font-family: Poppins, sans-serif;
  font-size: 13px;
  color: #040548;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pp-phone-item-dial {
  font-family: Poppins, sans-serif;
  font-size: 12px;
  color: #64748b;
  flex-shrink: 0;
}

/* ── Loading spinner on buttons ──────────────────────────────────────── */
.pp-modal__btn.loading {
  position: relative;
  color: transparent !important;
}

.pp-modal__btn.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ppSpin 0.7s linear infinite;
  /* Inherit the button text colour for the spinner */
  border-color: rgba(255,255,255,0.5);
  border-top-color: transparent;
}

.pp-modal__btn--secondary.loading::after {
  border-color: rgba(4,5,72,0.3);
  border-top-color: transparent;
}

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

/* ── Error messages ───────────────────────────────────────────────────── */
.pp-modal__error {
  color: #dc2626;
  font-family: Poppins, sans-serif;
  font-size: 13px;
  min-height: 0;
}

.pp-modal__server-error {
  color: #dc2626;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  text-align: center;
  margin: 0;
}

/* ── Terms ────────────────────────────────────────────────────────────── */
.pp-modal__terms {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pp-modal__checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-family: Poppins, sans-serif;
  font-size: 14px;
  color: #334155;
  cursor: pointer;
}

.pp-modal__checkbox-label input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  accent-color: #040548;
  cursor: pointer;
}

.pp-modal__checkbox-label a {
  color: #040548;
  text-decoration: underline;
}

/* ── CTA buttons ──────────────────────────────────────────────────────── */
.pp-modal__actions {
  display: flex;
  gap: 12px;
  align-self: stretch;
}

.pp-modal__btn {
  flex: 1;
  height: 52px;
  border-radius: 12px;
  font-family: Poppins, sans-serif;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
}

.pp-modal__btn:active {
  transform: scale(0.98);
}

.pp-modal__btn--secondary {
  background: #f1f5f9;
  color: #040548;
  border: 1px solid rgba(226, 232, 240, 0.98);
}

.pp-modal__btn--secondary:hover {
  background: #e2e8f0;
}

.pp-modal__btn--primary {
  background: #040548;
  color: #fff;
}

.pp-modal__btn--primary:hover {
  opacity: 0.88;
}

/* Loading state */
.pp-modal__btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .pp-modal__sheet {
    width: 100%;
    padding: 32px 20px;
    gap: 28px;
  }
}

@media (max-width: 600px) {
  .pp-modal__row {
    grid-template-columns: 1fr;
  }
  .pp-modal__radio-grid,
  .pp-modal__radio-pair {
    grid-template-columns: 1fr;
  }
  .pp-modal__actions {
    flex-direction: column;
  }
  .pp-modal__sheet {
    padding: 24px 16px;
    border-radius: 16px;
    gap: 20px;
  }
}
