/*
 * edit-section.css — visual layer for the Twig edit-section macro.
 * Voice + palette inherited from templates/tenant/_layout.twig inline
 * styles; kept minimal so Sessions 2/3 can layer on as patterns settle.
 */

[x-cloak] { display: none !important; }

.edit-section {
  background: #fff;
  border: 1px solid #d8e0ee;
  border-left: 4px solid transparent;
  border-radius: 4px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  transition: background-color .12s ease-out, border-left-color .12s ease-out;
}

/* Edit-mode visual highlight (Session 2). Toggled via Alpine
   :class="{'edit-section-active': editing}" on the <section> element so
   both edit-section and list-section macros get the same treatment. */
.edit-section.edit-section-active {
  background: #e6edf5;          /* soft blue-gray wash */
  border-left-color: #1d4ed8;   /* medium blue for the accent stripe */
}

.edit-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}

.edit-section-title {
  margin: 0;
  font-size: 1.1rem;
  color: #0033A0;
}

.edit-section-controls {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* Margin reset — the tenant layout has a global `button.primary` rule
   with `margin-top: 1rem`. The Save button has `.primary`, Cancel
   doesn't, so without a reset Save sits lower than Cancel. The
   compound selector below has higher specificity (0,2,1) than
   `button.primary` (0,1,1), so it wins regardless of stylesheet
   load order, and align-items:center then keeps the row centered. */
.edit-section-controls button,
.edit-section-controls button.primary,
.edit-section-controls button.edit-section-save-btn,
.edit-section-controls button.edit-section-cancel-btn,
.edit-section-controls button.edit-section-edit-btn {
  margin: 0;
}

.edit-section-controls button,
.edit-section-controls a.edit-section-edit-btn {
  background: #fff;
  color: #0033A0;
  border: 1px solid #c8d3e6;
  padding: .35rem .8rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
  line-height: 1.2;
  text-decoration: none;
  display: inline-block;
}

.edit-section-controls button:hover:not(:disabled),
.edit-section-controls a.edit-section-edit-btn:hover {
  background: #eaf1fb;
}

.edit-section-controls button:disabled,
.edit-section-controls a.edit-section-edit-btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  pointer-events: none;
}

.edit-section-controls .edit-section-save-btn,
.edit-section-controls button.primary {
  background: #0033A0;
  color: #fff;
  border-color: #0033A0;
}

.edit-section-controls .edit-section-save-btn:hover:not(:disabled),
.edit-section-controls button.primary:hover:not(:disabled) {
  background: #1944b3;
}

.edit-section-display {
  color: #0a1733;
  line-height: 1.5;
}

.edit-section-display p {
  margin: 0 0 .5rem 0;
}

.edit-section-display .text-muted,
.edit-section-display em {
  color: #7a8299;
  font-style: italic;
}

/* Read-only key/value list used by per-section display partials.
   Visually subordinates labels to values: labels are smaller, lighter,
   uppercase; values are full-weight body text. */
.settings-display-kv {
  margin: 0;
}

.settings-display-kv dt {
  font-size: .78rem;
  font-weight: 700;
  color: #0033A0;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: .9rem 0 .15rem 0;
}

.settings-display-kv dt:first-child { margin-top: 0; }

.settings-display-kv dd {
  margin: 0 0 .25rem 0;
  color: #111827;
  font-size: 1rem;
  line-height: 1.45;
  word-break: break-word;
}

.settings-display-kv dd a {
  color: #0033A0;
  text-decoration: none;
}
.settings-display-kv dd a:hover { text-decoration: underline; }

.settings-display-list {
  list-style: disc;
  padding-left: 1.1rem;
  margin: 0;
}

/* Edit-mode field labels — same visual treatment as the display-mode
   `<dt>` labels so the page feels consistent across the edit/display
   toggle, and labels stay clearly distinguishable from input values.
   Without this, labels inherit body color (#0a1733) which is identical
   to typed input values; with it, labels read unambiguously as labels. */
.edit-section-edit label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: #0033A0;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin: .9rem 0 .25rem 0;
}

.edit-section-edit label:first-of-type { margin-top: 0; }

/* Inline small annotations inside labels (e.g. "(optional)") opt out
   of the uppercase + tracking treatment so they read as supplemental. */
.edit-section-edit label small {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: #6b7280;
  font-size: .82rem;
  margin-left: .25rem;
}

.edit-section-edit textarea,
.edit-section-edit input[type=text],
.edit-section-edit input[type=url],
.edit-section-edit input[type=email],
.edit-section-edit input[type=tel] {
  width: 100%;
  max-width: 600px;
  padding: .5rem;
  border: 1px solid #c8d3e6;
  border-radius: 3px;
  font: inherit;
  font-size: 1rem;
  font-family: inherit;
}

.edit-section-edit textarea {
  min-height: 8rem;
  resize: vertical;
}

.edit-section-actions-inline {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .6rem;
  flex-wrap: wrap;
}

.edit-section-actions-inline button {
  background: transparent;
  border: 1px solid #c8d3e6;
  color: #0033A0;
  padding: .3rem .7rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
}

.edit-section-actions-inline button:hover:not(:disabled) {
  background: #eaf1fb;
}

.edit-section-actions-inline button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.edit-section-actions-inline small {
  color: #7a8299;
  font-size: .85rem;
}

.edit-section-error {
  background: #fde7e7;
  color: #a02323;
  padding: .5rem .75rem;
  border-radius: 3px;
  margin-top: .6rem;
  font-size: .9rem;
}

.edit-section-regenerate-notice {
  background: #fff7e6;
  color: #8a5a00;
  border-left: 3px solid #d97706;
  padding: .4rem .65rem;
  border-radius: 3px;
  margin-top: .5rem;
  font-size: .9rem;
}

@media (max-width: 540px) {
  .edit-section-header { flex-direction: column; align-items: flex-start; }
  .edit-section-controls { width: 100%; }
  .edit-section-controls button { flex: 1 1 0; }
}

/* ==== list-section ==================================================== */
.list-section .list-section-display,
.list-section .list-section-edit {
  list-style: none;
  margin: 0;
  padding: 0;
}

.list-section .list-row {
  border-bottom: 1px solid #eef1f5;
  padding: .55rem 0;
}

.list-section .list-row:last-child { border-bottom: 0; }

.list-section .list-row-display {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  justify-content: space-between;
}

.list-section .list-row-actions {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
}

.list-section .list-row-actions button {
  background: #fff;
  color: #0033A0;
  border: 1px solid #c8d3e6;
  padding: .25rem .65rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
  margin: 0;
  line-height: 1.2;
}

.list-section .list-row-actions button:hover:not(:disabled) {
  background: #eaf1fb;
}

.list-section .list-row-actions button:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.list-section .list-row-actions .list-row-remove {
  color: #a02323;
}

.list-section .list-row-actions .list-row-move {
  padding: .25rem .55rem;
  font-weight: 600;
}

.list-section .list-row-editing {
  /* One shade deeper than the section's edit-mode wash so the row
     being actively edited within an already-highlighted list section
     stays visually distinguishable. */
  background: #bfdbfe;
  margin: .25rem -.5rem;
  padding-left: .5rem;
  padding-right: .5rem;
  border-left: 3px solid #1d4ed8;
  border-bottom: 0;
}

.list-section .list-row-edit { padding: .35rem 0; }

.list-section .list-row-edit input[type=text],
.list-section .list-row-edit input[type=url],
.list-section .list-row-edit input[type=email],
.list-section .list-row-edit textarea,
.list-section .list-row-edit select {
  padding: .35rem .5rem;
  border: 1px solid #c8d3e6;
  border-radius: 3px;
  font: inherit;
  font-size: .95rem;
  font-family: inherit;
  margin: .15rem 0;
}

.list-section .list-row-edit textarea {
  width: 100%;
  min-height: 4rem;
  resize: vertical;
}

.list-section .list-row-edit-actions {
  display: flex;
  gap: .4rem;
  margin-top: .55rem;
}

.list-section .list-row-edit-actions button {
  background: #fff;
  color: #0033A0;
  border: 1px solid #c8d3e6;
  padding: .35rem .8rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
  margin: 0;
  line-height: 1.2;
}

.list-section .list-row-edit-actions button.primary {
  background: #0033A0;
  color: #fff;
  border-color: #0033A0;
}

.list-section .list-row-edit-actions button.primary:hover:not(:disabled) {
  background: #1944b3;
}

.list-section .list-row-edit-actions button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.list-section .list-row-edit-error {
  background: #fde7e7;
  color: #a02323;
  padding: .4rem .65rem;
  border-radius: 3px;
  margin-top: .5rem;
  font-size: .9rem;
}

.list-section .list-section-empty {
  color: #7a8299;
  font-size: .95rem;
  padding: .5rem 0;
}

.list-section .list-section-add {
  margin-top: .8rem;
}

.list-section .list-section-add-btn {
  background: #fff;
  color: #0033A0;
  border: 1px dashed #0033A0;
  padding: .35rem 1rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
  margin: 0;
}

.list-section .list-section-add-btn:hover {
  background: #eaf1fb;
}

/* Service-area badges (used by tenant /settings list-section embed). */
.service-area-badge {
  display: inline-block;
  padding: .1rem .5rem;
  background: #eaf1fb;
  color: #0033A0;
  border-radius: 3px;
  font-size: .8rem;
  letter-spacing: .02em;
}

.service-area-state {
  font-size: .85rem;
  color: #5a6678;
}

.service-area-primary {
  color: #0a7a3b;
  font-weight: 600;
  font-size: .85rem;
}

.service-area-name { font-weight: 500; }

.service-area-notes {
  display: block;
  color: #7a8299;
  font-size: .85rem;
  margin-top: .15rem;
}

/* ==== compare-and-accept modal (description AI ops) =================== */
.compare-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 23, 51, .55);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.compare-modal {
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.compare-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .75rem 1rem;
  border-bottom: 1px solid #e5e9f2;
}

.compare-modal-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #0033A0;
}

.compare-modal-close {
  background: none;
  border: 0;
  font-size: 1.4rem;
  line-height: 1;
  color: #5a6678;
  cursor: pointer;
  padding: .15rem .5rem;
  margin: 0;
}

.compare-modal-close:hover { color: #0a1733; }

.compare-modal-body {
  padding: .9rem 1rem;
  overflow-y: auto;
  flex: 1 1 auto;
}

.compare-modal-loading {
  color: #5a6678;
  font-size: .95rem;
  padding: .5rem 0;
}

.compare-modal-error {
  background: #fff7e6;
  color: #8a5a00;
  border-left: 3px solid #d97706;
  padding: .45rem .7rem;
  border-radius: 3px;
  margin-bottom: .8rem;
  font-size: .9rem;
}

.compare-modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .9rem;
}

.compare-modal-cell h4 {
  margin: 0 0 .35rem 0;
  font-size: .9rem;
  color: #5a6678;
}

.compare-modal-readonly {
  background: #f6f8fc;
  border: 1px solid #e5e9f2;
  border-radius: 3px;
  padding: .55rem .7rem;
  font-size: .92rem;
  color: #0a1733;
  white-space: pre-wrap;
  min-height: 7rem;
  max-height: 14rem;
  overflow-y: auto;
}

.compare-modal-use-btn {
  margin: .5rem 0 0 0;
  background: #fff;
  color: #0033A0;
  border: 1px solid #c8d3e6;
  padding: .3rem .85rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: .85rem;
}

.compare-modal-use-btn:hover:not(:disabled) {
  background: #eaf1fb;
}

.compare-modal-use-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.compare-modal-final {
  margin-top: .9rem;
}

.compare-modal-final h4 {
  margin: 0 0 .35rem 0;
  font-size: .9rem;
  color: #5a6678;
}

.compare-modal-final h4 small {
  font-weight: 400;
  color: #7a8299;
}

.compare-modal-final textarea {
  width: 100%;
  min-height: 7rem;
  padding: .55rem .7rem;
  border: 1px solid #c8d3e6;
  border-radius: 3px;
  font: inherit;
  font-family: inherit;
  font-size: .95rem;
  resize: vertical;
}

.compare-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .5rem;
  padding: .7rem 1rem;
  border-top: 1px solid #e5e9f2;
}

.compare-modal-footer button {
  background: #fff;
  color: #0033A0;
  border: 1px solid #c8d3e6;
  padding: .35rem 1rem;
  border-radius: 3px;
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
  margin: 0;
  line-height: 1.2;
}

.compare-modal-footer button.primary {
  background: #0033A0;
  color: #fff;
  border-color: #0033A0;
}

.compare-modal-footer button.primary:hover:not(:disabled) {
  background: #1944b3;
}

.compare-modal-footer button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  .compare-modal-grid { grid-template-columns: 1fr; }
  .compare-modal { max-height: 100vh; border-radius: 0; }
}
