/* project-fields.css — Modern professional input system for project detail tabs.
   Loaded after app.min.css / programme-theme.css. Plain CSS (not Tailwind)
   so edit-mode DOM generated by PHP helpers is covered without a rebuild. */

:root {
  --pf-border: #e2e8f0;
  --pf-border-hover: #cbd5e1;
  --pf-border-focus: var(--pg-focus, #2563eb);
  --pf-ring: rgba(37, 99, 235, 0.12);
  --pf-bg: #ffffff;
  --pf-bg-disabled: #f8fafc;
  --pf-text: #0f172a;
  --pf-placeholder: #94a3b8;
  --pf-label: #475569;
}

/* Field wrapper + label (replaces border-b separators with breathing room) */
.pf-field {
  padding-bottom: 0.85rem;
  margin-bottom: 0.85rem;
  border-bottom: 1px solid #f1f5f9;
}
.pf-field:last-child {
  border-bottom: 0;
  padding-bottom: 0;
  margin-bottom: 0;
}
.pf-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pf-label);
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

/* Core inputs — shared by text / number / date / select / textarea */
.pf-input,
.pf-select,
.pf-textarea,
input.pf-input,
select.pf-select,
textarea.pf-textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.65rem 0.85rem;
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--pf-text);
  background: var(--pf-bg);
  border: 1px solid var(--pf-border);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.pf-input::placeholder,
.pf-textarea::placeholder {
  color: var(--pf-placeholder);
}
.pf-input:hover,
.pf-select:hover,
.pf-textarea:hover {
  border-color: var(--pf-border-hover);
}
.pf-input:focus,
.pf-select:focus,
.pf-textarea:focus {
  outline: none;
  border-color: var(--pf-border-focus);
  background: #fff;
  box-shadow: 0 0 0 4px var(--pf-ring);
}
.pf-input:disabled,
.pf-select:disabled,
.pf-textarea:disabled {
  background: var(--pf-bg-disabled);
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

/* Selects: custom chevron, consistent with location combos */
.pf-select,
select.pf-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%2364748b' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.85rem center;
  background-size: 14px;
  cursor: pointer;
}
.pf-select:invalid {
  color: #94a3b8;
}

/* Textareas */
.pf-textarea,
textarea.pf-textarea {
  min-height: 88px;
  resize: vertical;
  line-height: 1.55;
}

/* Date + numeric alignment */
input[type="date"].pf-input {
  font-variant-numeric: tabular-nums;
}
.pf-input--money,
.pf-input--number {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Money prefix wrapper (LKR) — professional accounting affordance */
.pf-money {
  position: relative;
}
.pf-money .pf-money-prefix {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #64748b;
  pointer-events: none;
}
.pf-money .pf-input--money {
  padding-left: 3rem;
}

/* Unit suffix wrapper (km / m) — lengths are NOT money, no LKR prefix */
.pf-unit {
  position: relative;
}
.pf-unit .pf-unit-suffix {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: #64748b;
  pointer-events: none;
}
.pf-unit .pf-input--number {
  padding-right: 2.75rem;
}

/* Small helper text under inputs */
.pf-hint {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* ---- Location combos + authority segments: bring to same system ---- */
.loc-combo-btn {
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--pf-border);
  background: #fff;
  padding: 0.65rem 0.85rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.loc-combo-btn:hover {
  border-color: var(--pf-border-hover);
  background: #fff;
}
.loc-combo-btn:focus {
  outline: none;
  border-color: var(--pf-border-focus);
  box-shadow: 0 0 0 4px var(--pf-ring);
  background: #fff;
}
.loc-combo-btn[data-empty="1"] .loc-combo-val {
  color: var(--pf-placeholder);
  font-weight: 500;
}
.loc-combo-val {
  font-weight: 600;
}

.la-seg {
  border-radius: 12px;
  border: 1px solid var(--pf-border);
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
}
.la-seg:hover {
  border-color: var(--pf-border-focus);
  background: #fff;
}
.la-seg:focus {
  outline: none;
  border-color: var(--pf-border-focus);
  box-shadow: 0 0 0 4px var(--pf-ring);
}
.la-seg[data-selected="1"] {
  border-color: var(--pf-border-focus);
  background: #eff6ff;
  box-shadow: 0 0 0 4px var(--pf-ring);
}
.la-seg[data-selected="1"] .la-code {
  color: #1d4ed8;
}
.la-seg[data-selected="1"] .la-sub {
  color: #3b82f6;
}

/* Combo popover + search match the same radius language */
.loc-combo-pop {
  border-radius: 14px;
  border-color: #e2e8f0;
}
.loc-combo-search {
  border-radius: 10px;
  border-color: #e2e8f0;
  background: #fff;
  min-height: 40px;
}
.loc-combo-search:focus {
  outline: none;
  border-color: var(--pf-border-focus);
  box-shadow: 0 0 0 4px var(--pf-ring);
}

/* Geo identity — Province + DS Division values in dark blue (#1e3a8a) */
.pf-geo {
  color: #1e3a8a;
  font-weight: 600;
}
div[data-loc-field="province"] .loc-combo-val,
div[data-loc-field="ds_division"] .loc-combo-val,
div[data-loc-field="divisional_secretariat_division"] .loc-combo-val {
  color: #1e3a8a;
  font-weight: 700;
}
div[data-loc-field="province"] .loc-combo-btn[data-empty="1"] .loc-combo-val,
div[data-loc-field="ds_division"] .loc-combo-btn[data-empty="1"] .loc-combo-val,
div[data-loc-field="divisional_secretariat_division"] .loc-combo-btn[data-empty="1"] .loc-combo-val {
  color: #94a3b8;
  font-weight: 500;
}
.pf-input[name="province"],
.pf-select[name="province"],
.pf-input[name="ds_division"],
.pf-select[name="ds_division"],
.pf-input[name="divisional_secretariat_division"],
.pf-select[name="divisional_secretariat_division"] {
  color: #1e3a8a;
  font-weight: 600;
}

/* View-only definition grid — vertical + horizontal divider lines */
.pf-view-grid {
  gap: 0;
}
.pf-view-cell {
  padding: 0.8rem 0;
  border-bottom: 1px solid #e6ebf2;
}
.pf-view-cell:last-child {
  border-bottom: 0;
}
.pf-view-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-bottom: 0.25rem;
}
@media (min-width: 640px) {
  .pf-view-grid--2col > .pf-view-cell:nth-child(even) {
    border-left: 1px solid #e6ebf2;
    padding-left: 1.5rem;
  }
  .pf-view-grid--2col > .pf-view-cell:nth-child(odd) {
    padding-right: 1.5rem;
  }
}

/* Keep dense cert grids comfortable on small screens */
@media (max-width: 640px) {
  .pf-input,
  .pf-select,
  .pf-textarea {
    font-size: 0.875rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pf-input,
  .pf-select,
  .pf-textarea,
  .loc-combo-btn,
  .la-seg {
    transition: none;
  }
}
