/**
 * SpotRealty - Buyer Requirement Modal Modernization V1
 * Scoped styles for the "Edit Requirement" / "Add Requirement" modal.
 * Completely isolated to avoid affecting any host page or unrelated modules.
 */

/* Modal Backdrop */
#modalBackdropBuyerReq {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}

/* Modal Card Shell - Frozen Envelope: min(620px, 94vw), max-height: 92vh */
.sr-req-modal-card {
  width: min(620px, 94vw);
  max-height: 92vh;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  position: relative;
}

/* Compact Light Modern Header - 56px height */
.sr-req-header {
  background: #ffffff;
  border-bottom: 1px solid #f1f5f9;
  padding: 10px 20px;
  height: 56px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.sr-req-header-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.sr-req-header-title {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  line-height: 1.2;
  margin: 0;
}

.sr-req-header-subtitle {
  font-size: 12px;
  color: #64748b;
  margin-top: 2px;
  line-height: 1.2;
}

/* Circular Close Button - 32px */
.sr-req-close-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  box-sizing: border-box;
  padding: 0;
  flex-shrink: 0;
}

.sr-req-close-btn:hover {
  background-color: #f1f5f9;
  color: #0f172a;
}

.sr-req-close-btn:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Scrollable Modal Body - Compact Spacing */
.sr-req-body {
  padding: 14px 20px;
  flex: 1;
  overflow-y: auto;
  box-sizing: border-box;
  background: #ffffff;
}

.sr-req-body::-webkit-scrollbar {
  width: 6px;
}

.sr-req-body::-webkit-scrollbar-track {
  background: transparent;
}

.sr-req-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

.sr-req-body::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Form Sections */
.sr-req-section {
  margin-bottom: 10px;
}

/* Section Headings & Labels */
.sr-req-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 4px;
  line-height: 1.2;
  letter-spacing: normal;
  text-transform: none;
}

.sr-req-label-optional {
  font-size: 10.5px;
  font-weight: 400;
  color: #94a3b8;
  margin-left: 4px;
}

/* Dual Column Grid (50 / 50) */
.sr-req-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.sr-req-grid-last {
  margin-bottom: 0;
}

/* Compact Form Controls (Inputs & Selects) - 36px */
.sr-req-input,
.sr-req-select {
  width: 100%;
  height: 36px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  font-size: 12px;
  padding: 0 10px;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  font-family: inherit;
}

.sr-req-input::placeholder {
  color: #94a3b8;
}

.sr-req-input:focus,
.sr-req-select:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* Custom Select Dropdown Arrow */
.sr-req-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%2364748b' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 8px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 28px;
  cursor: pointer;
}

/* Multi-Select Preference Pills (30px, rounded-full) */
.sr-req-pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sr-req-pill {
  height: 30px;
  padding: 0 12px;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #475569;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.15s ease;
  box-sizing: border-box;
  user-select: none;
  outline: none;
  font-family: inherit;
}

.sr-req-pill:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #1e293b;
}

.sr-req-pill.active {
  background: #eef2ff;
  border-color: #6366f1;
  color: #4338ca;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(99, 102, 241, 0.12);
}

.sr-req-pill:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Specification Details Nested Surface - Compact */
.sr-req-spec-surface {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  box-sizing: border-box;
}

.sr-req-spec-eyebrow {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
}

.sr-req-spec-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4f46e5;
  display: inline-block;
}

.sr-req-spec-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}

.sr-req-subgroup {
  margin-bottom: 8px;
}

/* Configuration (BHK) Chips (28px, rounded-lg) */
.sr-req-chips-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sr-req-chip {
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  box-sizing: border-box;
  user-select: none;
  outline: none;
  font-family: inherit;
}

.sr-req-chip:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.sr-req-chip.active {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(79, 70, 229, 0.2);
}

.sr-req-chip:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Paired Input Containers (Min / Max) */
.sr-req-paired-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* Budget Row Grid: Min (1fr), Max (1fr), Unit (95px) */
.sr-req-budget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 95px;
  gap: 8px;
}

/* Land Row Grid: Min (1fr), Max (1fr), Unit (105px) */
.sr-req-land-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 105px;
  gap: 8px;
}

/* Light Sticky Footer - 50px height */
.sr-req-footer {
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
  padding: 8px 20px;
  height: 50px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Footer Cancel Button (34px, ghost/outline) */
.sr-req-btn-cancel {
  height: 34px;
  padding: 0 16px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  font-family: inherit;
}

.sr-req-btn-cancel:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.sr-req-btn-cancel:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

/* Footer Save Button (34px, primary indigo) */
.sr-req-btn-save {
  height: 34px;
  padding: 0 18px;
  border-radius: 6px;
  border: none;
  background: #4f46e5;
  color: #ffffff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  box-sizing: border-box;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.sr-req-btn-save:hover {
  background: #4338ca;
}

.sr-req-btn-save:focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 2px;
}

.sr-req-btn-save:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* Inline Validation Error Banner */
.sr-req-error-banner {
  padding: 8px 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 11.5px;
  color: #b91c1c;
  margin-bottom: 10px;
  box-sizing: border-box;
}

/* Responsive adjustment for narrow screens (< 640px) */
@media (max-width: 639px) {
  .sr-req-grid-2 {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sr-req-budget-grid {
    grid-template-columns: 1fr 1fr 80px;
  }
  .sr-req-body {
    padding: 12px 14px;
  }
  .sr-req-header {
    padding: 10px 14px;
  }
  .sr-req-footer {
    padding: 8px 14px;
  }
}
