/* Form building blocks shared by the create-event form and the owner
   dashboard: fields, cards, seating editor, uploads, sheets, toast.
   Needs tokens.css and base.css. */

/* checkbox row with wrapping text */
.agree {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 17px;
  cursor: pointer;
}

.agree input {
  width: 22px;
  height: 22px;
  flex: none;
  margin: 1px 0 0;
  accent-color: var(--red);
}

.agree a {
  color: var(--red);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--red);
  cursor: pointer;
}

.form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.form-card h3 {
  margin: 0;
  color: var(--red);
  font-size: 22px;
  font-weight: 400;
}

.card-head p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.card-head-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.field legend {
  margin-bottom: 8px;
  padding: 0;
}

.optional {
  color: var(--ink-soft);
}

.input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 19px; /* ≥16px stops iOS zooming on focus */
  -webkit-appearance: none;
  appearance: none;
}

.input::placeholder {
  color: var(--ink-soft);
  opacity: 0.8;
}

.input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgb(182 60 41 / 0.15);
}

.input[aria-invalid="true"] {
  border-color: var(--red);
  border-width: 2px;
}

select.input {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b5446' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

input[type="date"].input,
input[type="time"].input {
  display: flex;
  align-items: center;
}

input[type="date"].input::-webkit-date-and-time-value,
input[type="time"].input::-webkit-date-and-time-value {
  text-align: left;
}

.textarea {
  min-height: 140px;
  padding: 12px 16px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 16px;
  resize: vertical;
}

/* Password with a show/hide button inside the field. */
.password {
  position: relative;
}

.password .input {
  padding-right: 52px;
}

.password .icon-btn {
  position: absolute;
  top: 50%;
  right: 4px;
  color: var(--ink-soft);
  transform: translateY(-50%);
}

.pw-rules {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 16px;
}

.pw-rules li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pw-rules .icon {
  width: 18px;
  height: 18px;
  flex: none;
}

.pw-rules li.ok {
  color: var(--ink);
}

.pw-rules li.ok .icon {
  color: var(--red);
}

.hint {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.error {
  margin: 0;
  color: var(--red);
  font-size: 15px;
}

.row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--red);
  font: inherit;
  font-size: 18px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-soft {
  color: var(--ink-soft);
}

.hint a {
  color: var(--red);
}

/* ---- seating ------------------------------------------------------------- */
.actions-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.seating-tools {
  display: flex;
  gap: 8px;
}

.search {
  position: relative;
  flex: 1;
  min-width: 0;
}

.search .icon {
  position: absolute;
  left: 13px;
  top: 50%;
  width: 20px;
  height: 20px;
  color: var(--ink-soft);
  transform: translateY(-50%);
  pointer-events: none;
}

.search .input {
  min-height: 48px;
  padding-left: 42px;
}

.table-filter {
  width: 128px;
  flex: none;
  min-height: 48px;
}

.empty {
  margin: 0;
  padding: 18px 16px;
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink-soft);
  font-size: 17px;
  text-align: center;
}

.guest-table {
  overflow: hidden;
  border: 1.5px solid rgb(61 43 34 / 0.25);
  border-radius: 14px;
  background: var(--white);
}

.guest-head {
  display: flex;
  gap: 12px;
  padding: 8px 100px 8px 16px;
  background: var(--cream);
  color: var(--ink-soft);
  font-size: 15px;
}

.guest-head span:first-child {
  flex: 1;
}

.guest-head span:last-child {
  width: 56px;
}

.guest-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.guest-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 4px 2px 16px;
  border-top: 1px solid rgb(61 43 34 / 0.12);
}

.guest-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.guest-table-label {
  width: 56px;
  flex: none;
}

.guest-list .icon-btn {
  color: var(--ink-soft);
}

.guest-list .icon-btn.danger {
  color: var(--red);
}

.guest-list .icon {
  width: 19px;
  height: 19px;
}

.guest-list .no-match {
  justify-content: center;
  padding: 14px 16px;
  color: var(--ink-soft);
}

.show-all {
  width: 100%;
  min-height: 46px;
  border: 0;
  border-top: 1px solid rgb(61 43 34 / 0.12);
  background: var(--white);
  color: var(--red);
  font: inherit;
  font-size: 18px;
  cursor: pointer;
}

/* ---- uploads ------------------------------------------------------------- */
.upload {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 20px;
  border: 1.5px dashed var(--red);
  border-radius: 16px;
  background: var(--paper);
  text-align: center;
  cursor: pointer;
}

.dropzone .icon {
  width: 36px;
  height: 36px;
  color: var(--red);
}

.dropzone-title {
  font-size: 21px;
}

.upload:has(.file-input:focus-visible) .dropzone,
.upload:has(.file-input:focus-visible) .file {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
}

.dropzone.dragover {
  background: var(--cream);
  border-style: solid;
}

.file {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 16px;
  background: var(--white);
}

.file-thumb {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  flex: none;
  overflow: hidden;
  border-radius: 10px;
  background: var(--cream);
  color: var(--red);
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.file-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file .link {
  font-size: 17px;
}

.note {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--blue);
}

.note .icon {
  width: 22px;
  height: 22px;
  margin-top: 2px;
}

.note p {
  margin: 0;
  font-size: 17px;
}

.kv {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.kv > div {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 28px;
}

.kv dt {
  width: 118px;
  flex: none;
  color: var(--ink-soft);
}

.kv dd {
  flex: 1;
  min-width: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.kv .big {
  font-size: 21px;
}

.kv .red {
  color: var(--red);
}

.copy-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 12px;
  border: 1.5px solid var(--red);
  border-radius: 999px;
  background: var(--paper);
  color: var(--red);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.copy-chip .icon {
  width: 16px;
  height: 16px;
}

/* ---- sheets (dialogs) ---------------------------------------------------- */
.sheet {
  width: 100%;
  max-width: 560px;
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 12px 20px calc(24px + env(safe-area-inset-bottom));
  border: 0;
  border-radius: 24px 24px 0 0;
  background: var(--paper);
  color: var(--ink);
}

.sheet::backdrop {
  background: rgb(42 30 24 / 0.45);
}

.sheet form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-right: -10px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 400;
}

.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: -4px 0;
  color: var(--ink-soft);
  font-size: 15px;
}

.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgb(61 43 34 / 0.15);
}

.file-pick {
  align-self: flex-start;
}

.import-preview {
  margin: 0;
  min-height: 1.4em;
  font-size: 17px;
}

@media (min-width: 640px) {
  .sheet {
    margin: auto;
    border-radius: 24px;
  }

}

/* ---- toast --------------------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(72px + env(safe-area-inset-top));
  z-index: 60;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-size: 18px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.on {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }

}
