/* ═══════════════════════════════════════════════════════════
   Agency Portal Dialog — SurroScore
   Design system: --cream #FAF6F1 / --coral #E8725C / --teal #2A9D8F
   ═══════════════════════════════════════════════════════════ */

/* ── Overlay ── */
.ap-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(44,34,32,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
.ap-overlay.open { display: flex; }

/* ── Dialog ── */
.ap-dialog {
  background: #FAF6F1;
  border-radius: 20px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(44,34,32,0.18);
  position: relative;
  overflow: hidden;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  color: #2C2220;
}

/* ── Dialog Header ── */
.ap-header {
  background: linear-gradient(135deg, #2A9D8F 0%, #21867A 100%);
  padding: 24px 28px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
}
.ap-header-text h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}
.ap-header-text p {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.78);
  font-weight: 500;
}
.ap-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
  line-height: 1;
}
.ap-close:hover { background: rgba(255,255,255,0.25); }

/* ── Tabs ── */
.ap-tabs {
  background: #fff;
  border-bottom: 1px solid rgba(44,34,32,0.08);
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.ap-tabs::-webkit-scrollbar { display: none; }
.ap-tab {
  padding: 14px 20px;
  font-size: 0.83rem;
  font-weight: 700;
  color: #8A7E79;
  cursor: pointer;
  border-bottom: 2.5px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 6px;
}
.ap-tab:hover { color: #2C2220; }
.ap-tab.active {
  color: #2A9D8F;
  border-bottom-color: #2A9D8F;
}
.ap-tab-icon { font-size: 0.95rem; }

/* ── Tab Body ── */
.ap-body {
  overflow-y: auto;
  flex: 1;
  padding: 0;
}
.ap-panel {
  display: none;
  padding: 28px 28px 8px;
  animation: apFadeIn 0.15s ease;
}
.ap-panel.active { display: block; }
@keyframes apFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Form Elements ── */
.ap-section {
  margin-bottom: 28px;
}
.ap-section-title {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1rem;
  font-weight: 800;
  color: #2C2220;
  margin-bottom: 4px;
}
.ap-section-note {
  font-size: 0.78rem;
  color: #8A7E79;
  margin-bottom: 16px;
  line-height: 1.5;
}
.ap-section-note strong { color: #5C4F4A; }

.ap-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 600px) { .ap-grid-2 { grid-template-columns: 1fr; } }

.ap-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.ap-field:last-child { margin-bottom: 0; }
.ap-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #5C4F4A;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ap-label .ap-opt {
  font-weight: 400;
  color: #8A7E79;
  font-size: 0.75rem;
}
.ap-input,
.ap-textarea,
.ap-select {
  font-family: inherit;
  font-size: 0.88rem;
  color: #2C2220;
  background: #fff;
  border: 1.5px solid rgba(44,34,32,0.14);
  border-radius: 10px;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  width: 100%;
}
.ap-input:focus,
.ap-textarea:focus,
.ap-select:focus {
  border-color: #2A9D8F;
  box-shadow: 0 0 0 3px rgba(42,157,143,0.12);
}
.ap-textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.55;
}
.ap-textarea.large { min-height: 140px; }
.ap-input-hint {
  font-size: 0.74rem;
  color: #8A7E79;
  line-height: 1.45;
}
.ap-prefix-input {
  display: flex;
  align-items: center;
  border: 1.5px solid rgba(44,34,32,0.14);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ap-prefix-input:focus-within {
  border-color: #2A9D8F;
  box-shadow: 0 0 0 3px rgba(42,157,143,0.12);
}
.ap-prefix {
  padding: 10px 12px;
  font-size: 0.85rem;
  color: #8A7E79;
  background: #F3EDE5;
  border-right: 1.5px solid rgba(44,34,32,0.1);
  white-space: nowrap;
  font-weight: 600;
}
.ap-prefix-input .ap-input {
  border: none !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  background: transparent;
}

/* ── Divider ── */
.ap-divider {
  border: none;
  border-top: 1px solid rgba(44,34,32,0.08);
  margin: 24px 0;
}

/* ── Upload Zones ── */
.ap-upload-zone {
  border: 2px dashed rgba(44,34,32,0.15);
  border-radius: 12px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: #fff;
  position: relative;
}
.ap-upload-zone:hover,
.ap-upload-zone.drag-over {
  border-color: #2A9D8F;
  background: #E8F6F3;
}
.ap-upload-zone input[type=file] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}
.ap-upload-icon { font-size: 2rem; margin-bottom: 8px; }
.ap-upload-text { font-size: 0.85rem; font-weight: 600; color: #5C4F4A; margin-bottom: 4px; }
.ap-upload-hint { font-size: 0.75rem; color: #8A7E79; }
.ap-file-list {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ap-file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid rgba(44,34,32,0.1);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #5C4F4A;
}
.ap-file-item .ap-file-name { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-file-remove {
  background: none;
  border: none;
  color: #8A7E79;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.ap-file-remove:hover { color: #E8725C; background: #FCEAE6; }

/* ── Notice Box ── */
.ap-notice {
  background: #EAF5F3;
  border: 1px solid rgba(42,157,143,0.2);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 0.8rem;
  color: #21867A;
  line-height: 1.55;
  margin-bottom: 16px;
}
.ap-notice.public {
  background: #FFF8EC;
  border-color: rgba(212,168,83,0.25);
  color: #9A6C1A;
}

/* ── Add Row (Videos / Links) ── */
.ap-add-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.ap-add-row .ap-input { flex: 1; margin: 0; }
.ap-add-row .ap-label-input { flex: 0 0 160px; }
@media (max-width: 560px) {
  .ap-add-row { flex-direction: column; }
  .ap-add-row .ap-label-input { flex: unset; }
}
.ap-btn-add {
  background: #2A9D8F;
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
  flex-shrink: 0;
}
.ap-btn-add:hover { background: #21867A; }

.ap-item-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}
.ap-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid rgba(44,34,32,0.1);
  border-radius: 10px;
  padding: 10px 14px;
}
.ap-list-item .ap-item-info { flex: 1; min-width: 0; }
.ap-list-item .ap-item-title {
  font-size: 0.83rem;
  font-weight: 600;
  color: #2C2220;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ap-list-item .ap-item-sub {
  font-size: 0.75rem;
  color: #8A7E79;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.ap-list-item .ap-item-remove {
  background: none;
  border: none;
  color: #8A7E79;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 1rem;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.ap-list-item .ap-item-remove:hover { color: #E8725C; background: #FCEAE6; }

/* ── Review Cards ── */
.ap-review-card {
  background: #fff;
  border: 1px solid rgba(44,34,32,0.1);
  border-radius: 12px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.ap-review-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.ap-stars { color: #D4A853; font-size: 0.9rem; letter-spacing: 1px; }
.ap-review-date { font-size: 0.75rem; color: #8A7E79; }
.ap-review-text { font-size: 0.83rem; color: #5C4F4A; line-height: 1.6; margin-bottom: 12px; }
.ap-btn-respond {
  background: #E8F6F3;
  color: #2A9D8F;
  border: 1.5px solid rgba(42,157,143,0.2);
  border-radius: 8px;
  padding: 7px 16px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.ap-btn-respond:hover { background: #D4EFE9; border-color: #2A9D8F; }
.ap-response-area {
  margin-top: 12px;
  display: none;
}
.ap-response-area.open { display: block; }
.ap-response-area .ap-textarea { min-height: 80px; }
.ap-existing-response {
  background: #E8F6F3;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.8rem;
  color: #21867A;
  line-height: 1.55;
  margin-top: 8px;
  font-style: italic;
}
.ap-existing-response strong { font-style: normal; font-weight: 700; color: #21867A; }
.ap-response-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.ap-btn-save-response {
  background: #2A9D8F;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 16px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.ap-btn-save-response:hover { background: #21867A; }
.ap-btn-cancel-response {
  background: none;
  color: #8A7E79;
  border: 1px solid rgba(44,34,32,0.15);
  border-radius: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s;
}
.ap-btn-cancel-response:hover { color: #E8725C; border-color: #E8725C; }
.ap-no-reviews {
  text-align: center;
  padding: 40px 20px;
  color: #8A7E79;
  font-size: 0.88rem;
}
.ap-no-reviews .ap-no-reviews-icon { font-size: 2.5rem; margin-bottom: 10px; }

/* ── Submit Footer ── */
.ap-footer {
  background: #fff;
  border-top: 1px solid rgba(44,34,32,0.08);
  padding: 18px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  flex-wrap: wrap;
  /* Fix #5: sticky footer so submit is always visible */
  position: sticky;
  bottom: 0;
  z-index: 10;
  box-shadow: 0 -4px 16px rgba(44,34,32,0.06);
}
.ap-newsletter {
  flex: 1;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.ap-newsletter input[type=checkbox] {
  width: 17px;
  height: 17px;
  margin-top: 2px;
  cursor: pointer;
  accent-color: #2A9D8F;
  flex-shrink: 0;
}
.ap-newsletter label {
  font-size: 0.76rem;
  color: #8A7E79;
  cursor: pointer;
  line-height: 1.45;
}
.ap-btn-submit {
  background: linear-gradient(135deg, #E8725C 0%, #D4614D 100%);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 13px 32px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 800;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 4px 14px rgba(232,114,92,0.3);
  white-space: nowrap;
  flex-shrink: 0;
}
.ap-btn-submit:hover { opacity: 0.92; transform: translateY(-1px); }
.ap-btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* ── Success State ── */
.ap-success {
  display: none;
  text-align: center;
  padding: 48px 32px;
}
.ap-success.visible { display: block; }
.ap-success-icon { font-size: 3rem; margin-bottom: 16px; }
.ap-success h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.4rem;
  font-weight: 800;
  color: #2C2220;
  margin-bottom: 10px;
}
.ap-success p {
  font-size: 0.88rem;
  color: #5C4F4A;
  line-height: 1.6;
  max-width: 400px;
  margin: 0 auto;
}

/* ── Identity Section (always-visible strip above tabs) ── */
.ap-identity-section {
  background: #fff;
  border-bottom: 1px solid rgba(44,34,32,0.08);
  flex-shrink: 0;
}
.ap-identity-inner {
  padding: 20px 28px 4px;
}
.ap-identity-eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #E8725C;
  margin-bottom: 14px;
}
.ap-identity-section .ap-grid-2 {
  margin-bottom: 0;
}
.ap-identity-section .ap-field {
  margin-bottom: 14px;
}
@media (max-width: 640px) {
  .ap-identity-inner { padding: 16px 16px 4px; }
}

/* ── Manage Button (replaces Claim) ── */
.ap-manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #2A9D8F 0%, #21867A 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 24px;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(42,157,143,0.28);
  text-decoration: none;
  transition: opacity 0.15s, transform 0.15s;
}
.ap-manage-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* ── Claim form hint ── */
.ss-field-hint {
  font-size: 0.75rem;
  color: #8A7E79;
  line-height: 1.5;
  margin-top: -8px;
  margin-bottom: 4px;
}

/* ── Loading spinner ── */
.ap-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: apSpin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 6px;
}
@keyframes apSpin { to { transform: rotate(360deg); } }

/* ── Responsive ── */
@media (max-width: 640px) {
  .ap-dialog { max-height: 95vh; border-radius: 16px; }
  .ap-header { padding: 18px 20px 16px; }
  .ap-panel { padding: 20px 16px 8px; }
  .ap-footer { padding: 14px 16px; flex-direction: column; align-items: stretch; }
  .ap-btn-submit { text-align: center; }
  .ap-tab { padding: 12px 14px; font-size: 0.78rem; }
}

/* ── Excluded States Picker ── */
.ap-excluded-states {
  position: relative;
}
.ap-state-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.ap-state-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #E8F6F3;
  border: 1px solid rgba(42,157,143,0.2);
  border-radius: 20px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #2A9D8F;
  white-space: nowrap;
}
.ap-chip-x {
  background: none;
  border: none;
  color: #E8725C;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
  font-weight: 700;
}
.ap-chip-x:hover {
  color: #c4503c;
}
.ap-state-search {
  width: 100% !important;
}
.ap-state-dropdown {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  max-height: 180px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid rgba(44,34,32,0.12);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(44,34,32,0.1);
  z-index: 20;
}
.ap-state-option {
  padding: 8px 14px;
  font-size: 0.82rem;
  cursor: pointer;
  color: #2C2220;
  transition: background 0.12s;
}
.ap-state-option:hover {
  background: #E8F6F3;
  color: #2A9D8F;
}
