/* Hounds — Componentes: botões, campos, grade e página de mapa, modal */

/* Buttons and fields */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font-weight: 600; font-size: 13px; cursor: pointer; text-decoration: none; white-space: nowrap; }
/* The buttons of the sheet's sections (Editar, Cancelar, Salvar): all the same width. */
.btn.sec-btn { min-width: 104px; }
.btn:hover { background: var(--surface-2); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: rgba(248,113,113,.4); background: transparent; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); color: var(--danger-ink); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lab { font-size: 12px; font-weight: 700; color: var(--muted); }
.field input[type=text], .field input[type=email], .field input[type=password], .field textarea, .field select { background: var(--well); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; color: var(--text); font-size: 14px; width: 100%; box-sizing: border-box; }
.field textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent; }
.field .err { font-size: 12px; color: var(--danger); min-height: 0; }
.field.invalid input, .field.invalid .drop { border-color: var(--danger); }

/* Maps grid */
.maps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.map-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; text-decoration: none; color: inherit; transition: border-color .15s ease, transform .15s ease; }
.map-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.map-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.thumb { aspect-ratio: 4 / 3; max-width: 100%; background: var(--well); border-bottom: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; color: var(--faint); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.map-card-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.map-card-body strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meta { font-family: var(--font-mono); font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.empty-state { border: 1px dashed var(--line-2); border-radius: 14px; padding: 40px 20px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; color: var(--muted); }
.empty-state strong { color: var(--text); font-size: 16px; }

/* Single map page */
.preview { background: var(--well); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; display: grid; place-items: center; max-height: 62vh; min-height: 200px; }
.preview img { max-width: 100%; max-height: 62vh; width: auto; height: auto; display: block; }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.mk-item { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; padding: 8px; border-radius: 9px; border: 1px solid transparent; background: transparent; cursor: pointer; min-width: 0; }
.mk-item:hover { background: var(--surface-2); }
.mk-item.sel { border-color: rgba(245,158,11,.4); background: var(--accent-soft); }
.mk-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.mk-item .t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.mk-item .t b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-item .t span { font-size: 11px; color: var(--faint); }
.dot { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; color: #0b1222; }
.confirm { border: 1px solid rgba(248,113,113,.4); background: var(--danger-soft); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: var(--overlay); z-index: 60; display: grid; place-items: center; padding: 16px; padding-top: calc(16px + env(safe-area-inset-top, 0px)); }
.modal-back[hidden] { display: none; }
.modal { width: 100%; max-width: 520px; max-height: calc(100% - 8px); overflow-y: auto; background: var(--rail); border: 1px solid var(--line-2); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 16px; box-sizing: border-box; }
.modal h2 { margin: 0; font-size: 19px; padding-right: 40px; }
/* Close button: stays at the top right while the form scrolls, without taking a row of its own. */
.modal .modal-x { position: sticky; top: 0; align-self: flex-end; margin: -6px -6px -44px 0; z-index: 1; background: var(--rail); }
.modal .modal-x:hover { background: var(--surface); }
/* "Unsaved changes" bar: stays visible at the bottom while the form scrolls. */
.modal .modal-discard { position: sticky; bottom: -20px; z-index: 2; background: var(--rail); margin: 0 -20px -20px; padding: 0 20px 20px; }
.drop { border: 1.5px dashed var(--line-2); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; color: var(--muted); cursor: pointer; background: var(--well); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop small { color: var(--faint); }
.pv { background: var(--well); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: grid; place-items: center; }
.pv img { max-width: 100%; max-height: 240px; display: block; }
.pv-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--faint); padding: 8px 10px; border-top: 1px solid var(--line); width: 100%; box-sizing: border-box; }
.pv-meta span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-err { font-size: 13px; color: var(--danger); }
