/* ═══════════════════════════════════════════════════════════════════════════
   FormStyles.module.css
   Generic form CSS — used by CompanyForm, ProposalForm, and any future forms
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Modal Overlay ──────────────────────────────────────────────────────── */
.modalOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modalContent {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 820px;
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.18);
}

/* ── Modal Header ───────────────────────────────────────────────────────── */
.modalHeader {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  background: linear-gradient(135deg, #f0fdfa 0%, #fff 100%);
  flex-shrink: 0;
}

.modalTitle {
  font-size: 17px;
  font-weight: 700;
  color: #111827;
  margin: 0;
}

.modalSubtitle {
  font-size: 12px;
  color: #6b7280;
  margin: 4px 0 0;
}

.closeBtn {
  background: #f3f4f6;
  border: none;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 16px;
  color: #6b7280;
  transition: all 0.15s ease;
  flex-shrink: 0;
  line-height: 1;
}

.closeBtn:hover {
  background: #fee2e2;
  color: #dc2626;
}

/* ── Form Body (scrollable) ─────────────────────────────────────────────── */
.form {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-height: 0;
}

.formBody {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Section Header ─────────────────────────────────────────────────────── */
.sectionHeader {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: #0f766e;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 20px 0 12px;
}

.sectionHeader:first-child {
  margin-top: 0;
}

.sectionDot {
  display: inline-block;
  width: 4px;
  height: 16px;
  border-radius: 2px;
  background: #14b8a6;
  flex-shrink: 0;
}

/* ── Grid Layouts ───────────────────────────────────────────────────────── */
.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.grid3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
}

.full {
  grid-column: 1 / -1;
}

/* ── Form Group ─────────────────────────────────────────────────────────── */
.formGroup {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ── Labels ─────────────────────────────────────────────────────────────── */
.label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.labelRequired::after {
  content: " *";
  color: #ef4444;
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */
.input,
.inputSmall {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #111827;
  background: #fafafa;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s;
  box-sizing: border-box;
  font-family: inherit;
}

.input:focus,
.inputSmall:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
  background: #fff;
}

.input::placeholder,
.inputSmall::placeholder {
  color: #9ca3af;
  font-size: 12px;
}

.inputError {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
  background: #fff9f9 !important;
}

/* ── Textarea ───────────────────────────────────────────────────────────── */
.textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #111827;
  background: #fafafa;
  outline: none;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.textarea:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
  background: #fff;
}

/* ── Select (native) ────────────────────────────────────────────────────── */
.select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  color: #111827;
  background: #fafafa;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  font-family: inherit;
}

.select:focus {
  border-color: #14b8a6;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}

/* ── react-select overrides (apply via classNamePrefix="rselect") ───────── */
:global(.rselect__control) {
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  background: #fafafa !important;
  font-size: 13px !important;
  min-height: 38px !important;
  box-shadow: none !important;
  transition: border-color 0.15s, box-shadow 0.15s !important;
}

:global(.rselect__control:hover) {
  border-color: #14b8a6 !important;
}

:global(.rselect__control--is-focused) {
  border-color: #14b8a6 !important;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12) !important;
  background: #fff !important;
}

:global(.rselect__option--is-focused) {
  background: #f0fdfa !important;
  color: #111827 !important;
}

:global(.rselect__option--is-selected) {
  background: #14b8a6 !important;
  color: #fff !important;
}

:global(.rselect__multi-value) {
  background: #f0fdfa !important;
  border: 1px solid #99f6e4 !important;
  border-radius: 6px !important;
}

:global(.rselect__multi-value__label) {
  color: #0f766e !important;
  font-size: 11px !important;
  font-weight: 600 !important;
}

:global(.rselect__multi-value__remove:hover) {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

:global(.rselect__placeholder) {
  color: #9ca3af !important;
  font-size: 12px !important;
}

:global(.rselect__menu) {
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1) !important;
  border: 1px solid #e5e7eb !important;
  z-index: 9999 !important;
}

/* ── Error messages ─────────────────────────────────────────────────────── */
.error {
  font-size: 11px;
  color: #ef4444;
  margin-top: 2px;
}

.errorAnimate {
  animation: shake 0.2s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-4px); }
  75%       { transform: translateX(4px); }
}

/* ── File Upload ────────────────────────────────────────────────────────── */
.fileUploadZone {
  border: 2px dashed #d1d5db;
  border-radius: 10px;
  padding: 18px;
  text-align: center;
  background: #fafafa;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.fileUploadZone:hover {
  border-color: #14b8a6;
  background: #f0fdfa;
}

.fileUploadZoneDragOver {
  border-color: #14b8a6 !important;
  background: #f0fdfa !important;
}

.fileUploadIcon {
  font-size: 28px;
  margin-bottom: 6px;
}

.fileUploadText {
  font-size: 13px;
  color: #6b7280;
}

.fileUploadHint {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 3px;
}

.fileHiddenInput {
  display: none;
}

/* Uploaded file list */
.fileList {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fileItem {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 12px;
  color: #374151;
}

.fileItemName {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.fileItemName span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fileRemoveBtn {
  background: #fee2e2;
  border: none;
  border-radius: 5px;
  padding: 3px 8px;
  cursor: pointer;
  color: #dc2626;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  transition: background 0.15s;
}

.fileRemoveBtn:hover {
  background: #fca5a5;
}

/* ── Checkbox Standards ─────────────────────────────────────────────────── */
.checkboxGroup {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkboxItem {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #fafafa;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.checkboxItem:hover {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.checkboxItemActive {
  border-color: #14b8a6;
  background: #f0fdfa;
}

.checkboxItemLabel {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
}

.checkboxItemSub {
  font-size: 11px;
  color: #6b7280;
  margin-top: 1px;
}

/* ── Modal Footer ───────────────────────────────────────────────────────── */
.modalFooter {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
  flex-shrink: 0;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btnPrimary,
.saveBtn {
  padding: 9px 24px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, box-shadow 0.15s;
  box-shadow: 0 2px 8px rgba(20, 184, 166, 0.3);
  font-family: inherit;
}

.btnPrimary:hover,
.saveBtn:hover {
  opacity: 0.9;
  box-shadow: 0 4px 12px rgba(20, 184, 166, 0.4);
}

.btnPrimary:disabled,
.saveBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btnSecondary,
.cancelBtn {
  padding: 9px 20px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #374151;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}

.btnSecondary:hover,
.cancelBtn:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

.btnDanger {
  padding: 9px 20px;
  border: none;
  border-radius: 8px;
  background: #fee2e2;
  color: #dc2626;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

.btnDanger:hover {
  background: #fca5a5;
}

/* ── Loading state ──────────────────────────────────────────────────────── */
.loadingSpinner {
  padding: 40px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

.loadingSpinnerIcon {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #e5e7eb;
  border-top-color: #14b8a6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 8px;
}

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

/* ── Inline alert ───────────────────────────────────────────────────────── */
.alertError {
  padding: 10px 14px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  font-size: 13px;
  color: #dc2626;
  margin-bottom: 12px;
}

.alertSuccess {
  padding: 10px 14px;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: 8px;
  font-size: 13px;
  color: #065f46;
  margin-bottom: 12px;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .grid2,
  .grid3 {
    grid-template-columns: 1fr;
  }

  .modalContent {
    max-height: 100vh;
    border-radius: 12px 12px 0 0;
    align-self: flex-end;
  }

  .formBody {
    padding: 16px;
  }

  .modalHeader {
    padding: 16px;
  }

  .modalFooter {
    padding: 12px 16px;
  }
}
