/* styles/default/components/c-modal.css — #9 modál (nativní <dialog>): velikosti, sheet na mobilu, confirm, stavy
   Created :: 2026-10-21
   Updated :: 2026-10-28
   2026-10-28 :: M9 – úklid a revize (viz 04 kap. 3) */

.c-modal {
  width: min(var(--modal-md), calc(100% - 2 * var(--sp-4)));
  max-height: calc(100dvh - 2 * var(--sp-6));
  margin: auto;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--sh-lg);
  overflow: hidden;
}
.c-modal[open] { animation: c-modal-in var(--dur-2) var(--ease-out); }
.c-modal::backdrop { background: var(--color-backdrop); }
.c-modal--sm { width: min(var(--modal-sm), calc(100% - 2 * var(--sp-4))); }
.c-modal--md { width: min(var(--modal-md), calc(100% - 2 * var(--sp-4))); }   /* výchozí šířka, modifikátor kvůli partials/modal.php (M9-10, N85) */
.c-modal--lg { width: min(var(--modal-lg), calc(100% - 2 * var(--sp-4))); }

.c-modal__frame { display: flex; flex-direction: column; max-height: calc(100dvh - 2 * var(--sp-6)); }
.c-modal__header { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--color-border); }
.c-modal__title { flex: 1; min-width: 0; font-size: var(--fs-lg); font-weight: var(--fw-semibold); line-height: var(--lh-tight); letter-spacing: var(--ls-tight); }
.c-modal__body { flex: 1; min-height: 0; overflow: auto; padding: var(--sp-5); }
.c-modal__footer { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: flex-end; align-items: center; padding: var(--sp-3) var(--sp-5); border-top: 1px solid var(--color-border); background: var(--color-surface-2); }
.c-modal__footer-note { margin-right: auto; font-size: var(--fs-sm); color: var(--color-text-muted); }

/* Potvrzení */
.c-modal--confirm .c-modal__body { display: flex; gap: var(--sp-4); align-items: flex-start; }
.c-modal__confirm-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 4rem; height: 4rem; border-radius: var(--r-full); background: var(--color-danger-soft); color: var(--color-danger); }
.c-modal--confirm.c-modal--info .c-modal__confirm-icon { background: var(--color-info-soft); color: var(--color-info); }
.c-modal__confirm-text { font-size: var(--fs-base); color: var(--color-text-muted); margin-top: var(--sp-1); }

/* Stavy */
.c-modal.is-loading .c-modal__body { min-height: 16rem; }

/* Sheet: vynucený (--sheet) i automatický na mobilu */
.c-modal--sheet,
.c-modal--sheet.c-modal--sm,
.c-modal--sheet.c-modal--lg {
  width: 100%;
  max-height: 92dvh;
  margin: auto 0 0;
  border-bottom: 0;
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
.c-modal--sheet .c-modal__frame { max-height: 92dvh; }
.c-modal--sheet[open] { animation: c-sheet-in var(--dur-3) var(--ease-out); }

@media (max-width: 767.98px) {
  .c-modal, .c-modal--sm, .c-modal--lg {
    width: 100%;
    max-height: 92dvh;
    margin: auto 0 0;
    border-bottom: 0;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
  }
  .c-modal__frame { max-height: 92dvh; }
  .c-modal[open] { animation: c-sheet-in var(--dur-3) var(--ease-out); }
  .c-modal__header, .c-modal__body { padding-inline: var(--sp-4); }
  .c-modal__footer { padding-inline: var(--sp-4); position: sticky; bottom: 0; }
}

@keyframes c-modal-in { from { opacity: 0; transform: translateY(.8rem) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes c-sheet-in { from { transform: translateY(100%); } to { transform: none; } }
