@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── box-sizing reset scoped pouze na modal ── */
modal-overlay *,
modal-overlay *::before,
modal-overlay *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ── CSS proměnné scoped na modal-overlay ───────────────────
   Nedostanou se do konfliktu s proměnnými hostitelské aplikace.
   Všechny selektory uvnitř modal-overlay je dědí automaticky.
   ─────────────────────────────────────────────────────────── */
modal-overlay {
  --col-bg:    #13141d;
  --card-bg:   #191b28;
  --card-bg2:  #1d2032;
  --border:    #252840;
  --border2:   #2c3050;
  --text:      #c8d0f0;
  --text2:     #8b93bc;
  --text3:     #525878;
  --accent:    #6366f1;
  --accent2:   #a5b4fc;
  --green:     #4ade80;
  --red:       #f87171;
  --mono:      'JetBrains Mono', monospace;
  --sans:      'Inter', sans-serif;

  /* ── overlay vlastnosti ── */
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(9, 10, 20, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: mOverlayIn .2s ease;
  font-family: var(--sans);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

/* ════════════════════════════════════════════════════════════
   CUSTOM ELEMENTS — modal kostra
   ════════════════════════════════════════════════════════════ */

modal-window {
  display: flex;
  flex-direction: column;
  background: var(--col-bg);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  box-shadow: 0 32px 80px rgba(0, 0, 0, .65);
  overflow: hidden;
  animation: mWindowIn .25s cubic-bezier(.22, .68, 0, 1.2);
}

/* window-label — nepovinný barevný proužek nahoře */
window-label {
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 16px 16px 0 0;
  flex-shrink: 0;
}
window-label:empty { display: none; }

/* ── header ──────────────────────────────────────────────── */
modal-window > header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

/* první div v headeru = ikonka + titulky */
modal-window > header > div:first-child {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.hdr-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  background: rgba(99, 102, 241, .15);
  border: 1px solid rgba(99, 102, 241, .3);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.hdr-icon svg { width: 18px; height: 18px; stroke: var(--accent2); }

.hdr-text { flex: 1; min-width: 0; }
.hdr-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hdr-sub {
  font-size: 12px;
  color: var(--text3);
}

close-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border2);
  border-radius: 7px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .15s, color .15s;
  align-self: flex-start;
}
close-button:hover { background: var(--card-bg); color: var(--text); }
close-button svg { width: 13px; height: 13px; pointer-events: none; }

/* progress-bar — 4px pulzující linka */
progress-bar {
  display: block;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--border);
  overflow: hidden;
}
progress-bar::after {
  content: '';
  display: block;
  height: 100%;
  width: 40%;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: mProgress 1.4s ease-in-out infinite;
}

modal-window.in-progress main, modal-window.in-progress footer {
  pointer-events: none;  
}
modal-window.in-progress main, modal-window.in-progress footer { opacity: .7}



/* ── main ────────────────────────────────────────────────── */
modal-window > main {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 18px 20px;
  overflow-y: auto;
  flex: 1;
  transition: all .3s ease-in-out
}
modal-window > main::-webkit-scrollbar { width: 4px; }
modal-window > main::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }

/* ── footer ──────────────────────────────────────────────── */
modal-window > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--card-bg2);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════
   OBSAH FORMULÁŘE
   ════════════════════════════════════════════════════════════ */

/* dvousloupcový řádek */
.mf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* field */
.mf { display: flex; flex-direction: column; gap: 5px; }

/* label */
.ml {
  font-size: 11px;
  font-weight: 500;
  color: var(--text2);
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 5px;
}
.ml-req { color: var(--accent2); }
.ml-hint { font-size: 10px; color: var(--text3); font-weight: 400; margin-left: auto; }

/* input / select / textarea */
.mi, .ms, .mta {
  background: var(--card-bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 11px;
  outline: none;
  width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
.mi::placeholder, .mta::placeholder { color: var(--text3); }
.mi:focus, .ms:focus, .mta:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.mi.mi-err { border-color: var(--red); }

.ms {
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' stroke='%23525878' stroke-width='1.3' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
.ms option { background: var(--card-bg2); }

.mta { resize: vertical; min-height: 90px; line-height: 1.6; }
.mta-wrap { position: relative; }
.mta-count {
  position: absolute;
  bottom: 8px; right: 10px;
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  pointer-events: none;
}

/* chybová zpráva */
.mi-err-msg {
  font-size: 11px;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 4px;
}
.mi-err-msg svg { width: 12px; height: 12px; stroke: var(--red); flex-shrink: 0; }

/* tag input */
.mtags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 7px 9px;
  min-height: 40px;
  cursor: text;
  transition: border-color .15s, box-shadow .15s;
}
.mtags:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.mtag {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 5px;
  background: rgba(99,102,241,.18);
  border: 1px solid rgba(99,102,241,.35);
  color: var(--accent2);
  white-space: nowrap;
}
.mtag-x { cursor: pointer; color: var(--text3); line-height: 1; }
.mtag-x:hover { color: var(--text); }
.mtags > input {
  border: none;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 13px;
  outline: none;
  flex: 1;
  min-width: 120px;
}
.mtags > input::placeholder { color: var(--text3); }

/* sekční oddělovač */
.mf-div {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mf-div::before, .mf-div::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* checkbox */
.mchk { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.mchk input[type="checkbox"] {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid var(--border2);
  background: var(--card-bg);
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  position: relative;
  transition: background .15s, border-color .15s;
}
.mchk input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.mchk input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 1px;
  width: 5px; height: 9px;
  border: 1.5px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(42deg);
}
.mchk-label { font-size: 12px; color: var(--text2); line-height: 1.5; }
.mchk-sub   { font-size: 11px; color: var(--text3); margin-top: 1px; }
.mchk-group { display: flex; flex-direction: column; gap: 8px; }

/* radio */
.mchk input[type="radio"] {
  appearance: none;
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border2);
  background: var(--card-bg);
  flex-shrink: 0;
  margin-top: 2px;
  cursor: pointer;
  position: relative;
  transition: background .15s, border-color .15s;
}
.mchk input[type="radio"]:checked { background: var(--accent); border-color: var(--accent); }
.mchk input[type="radio"]:checked::after {
  content: '';
  position: absolute;
  left: 4px; top: 4px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
}

/* toggle switch */
.mtoggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.mtoggle-label { font-size: 12px; font-weight: 500; color: var(--text); }
.mtoggle-sub   { font-size: 11px; color: var(--text3); margin-top: 1px; }
.sw { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.sw input { opacity: 0; width: 0; height: 0; position: absolute; }
.sw-track {
  position: absolute; inset: 0;
  border-radius: 10px;
  background: var(--border2);
  cursor: pointer;
  transition: background .2s;
}
.sw input:checked + .sw-track { background: var(--accent); }
.sw-track::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px; left: 3px;
  transition: left .2s;
}
.sw input:checked + .sw-track::after { left: 19px; }


/* ── file-manager list ──────────────────────────────────────── */

// sizing	
.fmgr {
  border: 1px solid var(--border2);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card-bg);
}

/* hlavička */
.fmgr-head {
  display: grid;
  padding: 7px 12px;
  border-bottom: 1px solid var(--border2);
  font-size: 10px;
  font-weight: 100;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
}

/* prázdný čtvrtý sloupec hlavičky */
.fmgr-head::after {
  content: '';
  display: block;
}

/* řádek — celý je <label> kvůli radio */
.fmgr-row {
  display: grid;
  align-items: center;
  padding: 0 12px;
  min-height: 38px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background .1s;
  user-select: none;
}
.fmgr-row:last-child { border-bottom: none; }
.fmgr-row:hover { background: rgba(99, 102, 241, .06); }

.fmgr-head.cols-2, .fmgr-row.cols-2 { grid-template-columns: 1fr 32px }
.fmgr-head.cols-4, .fmgr-row.cols-4 { grid-template-columns: 1fr 110px 80px 32px; }

/* skrytý radio button */
.fmgr-radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* vybraný řádek */
.fmgr-row:has(.fmgr-radio:checked) {
  background: rgba(99, 102, 241, .1);
  box-shadow: inset 3px 0 0 var(--accent);
}
.fmgr-row:has(.fmgr-radio:checked) .fmgr-col:first-of-type {
  color: var(--accent2);
  font-weight: 500;
}
.fmgr-row:has(.fmgr-radio:checked) .fmgr-icon {
  color: var(--accent2);
}

/* disabled řádek */
.fmgr-row--disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* sloupce */
.fmgr-col {
  font-size: 12px;
  color: var(--text2);
  display: flex;
  align-items: center;
  gap: 7px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
/*
.fmgr-col--date {
  color: var(--text3);
  font-family: var(--mono);
  font-size: 11px;
}
.fmgr-col--flag {
  justify-content: flex-end;
}
*/

/* ikona souboru */
.fmgr-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--text3);
}

/* badge / flag */
.fmgr-badge { font-size: 10px; font-weight: 500; letter-spacing: .05em; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.fmgr-badge--active   { background: rgba(74, 222, 128, .12);  color: #4ade80;        border: 1px solid rgba(74, 222, 128, .25); }
.fmgr-badge--normal   { background: rgba(99, 102, 241, .12);  color: var(--accent2); border: 1px solid rgba(99, 102, 241, .25); }
.fmgr-badge--unactive { background: rgba(139, 147, 188, .12); color: var(--text2);   border: 1px solid var(--border2); }
.fmgr-badge--disabled { background: transparent;  color: var(--text3);   border: 1px solid var(--border); }

/* tlačítko koše */
.fmgr-del {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity .15s, background .15s, color .15s;
}
.fmgr-del svg { width: 13px; height: 13px; }
.fmgr-del:hover { background: rgba(248, 113, 113, .12); color: var(--red); }

/* zobraz koš jen při hoveru na řádek */
.fmgr-row:hover .fmgr-del { opacity: 1; }


/* ════════════════════════════════════════════════════════════
   Footer
   ════════════════════════════════════════════════════════════ */


/* footer buttons */
.footer-meta {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}
.footer-meta svg { width: 13px; height: 13px; stroke: var(--text3); }
.footer-btns { display: flex; gap: 8px; }

/* Buttons */
.footer-btns button {
  display: flex;
  gap: 7px;
  align-items: center;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text2);
  font-family: var(--sans);
  font-size: 12px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.footer-btns button svg { width: 13px; height: 13px; }

/*.btn-ghost:hover { background: var(--card-bg); color: var(--text); }*/

.footer-btns button.save, .footer-btns button.confirm { background: var(--accent); color: #fff; font-weight: 600; cursor: pointer; }
.footer-btns button.save:hover   { background: #5254d4; }
.footer-btns button.save:disabled { opacity: .45; cursor: not-allowed; }

.footer-btns button.delete { background: var(--red); color: #fff; font-weight: 600; cursor: pointer; }

/* ── alert / warning boxy ───────────────────────────────────── */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 12px 14px;
  border-radius: 9px;
  border: 1px solid;
}

.alert::before {
  content: '';
  display: block;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.alert-title {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 2px;
}

.alert-desc {
  font-size: 12px;
  line-height: 1.55;
  color: var(--text2);
}

/* ── success (zelená) ── */
.alert--success {
  background: rgba(74, 222, 128, .08);
  border-color: rgba(74, 222, 128, .25);
}
.alert--success .alert-title { color: #4ade80; }
.alert--success::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.5' stroke='%234ade80' stroke-width='1.4'/%3E%3Cpath d='M6.5 10.2l2.4 2.4 4.6-5.2' stroke='%234ade80' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ── info (modrá) ── */
.alert--info {
  background: rgba(99, 102, 241, .08);
  border-color: rgba(99, 102, 241, .25);
}
.alert--info .alert-title { color: var(--accent2); }
.alert--info::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.5' stroke='%23a5b4fc' stroke-width='1.4'/%3E%3Cpath d='M10 9v5' stroke='%23a5b4fc' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='6.3' r='1.05' fill='%23a5b4fc'/%3E%3C/svg%3E");
}

/* ── warning (žlutá/oranžová) ── */
.alert--warning {
  background: rgba(251, 191, 36, .08);
  border-color: rgba(251, 191, 36, .28);
}
.alert--warning .alert-title { color: #fbbf24; }
.alert--warning::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M10 2.5l8.2 14.3a1 1 0 01-.87 1.5H2.67a1 1 0 01-.87-1.5L10 2.5z' stroke='%23fbbf24' stroke-width='1.4' stroke-linejoin='round'/%3E%3Cpath d='M10 8.2v4' stroke='%23fbbf24' stroke-width='1.6' stroke-linecap='round'/%3E%3Ccircle cx='10' cy='14.8' r='1.05' fill='%23fbbf24'/%3E%3C/svg%3E");
}

/* ── error (červená) ── */
.alert--error {
  background: rgba(248, 113, 113, .08);
  border-color: rgba(248, 113, 113, .28);
}
.alert--error .alert-title { color: var(--red); }
.alert--error::before {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none'%3E%3Ccircle cx='10' cy='10' r='8.5' stroke='%23f87171' stroke-width='1.4'/%3E%3Cpath d='M7.3 7.3l5.4 5.4M12.7 7.3l-5.4 5.4' stroke='%23f87171' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}



/* ════════════════════════════════════════════════════════════
   ANIMACE
   ════════════════════════════════════════════════════════════ */
@keyframes mOverlayIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes mWindowIn {
  from { opacity: 0; transform: translateY(14px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
@keyframes mProgress {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* zavření */
modal-overlay.closing { animation: mOverlayOut .25s ease forwards; }
modal-overlay.closing modal-window { animation: mWindowOut .25s cubic-bezier(.4,0,1,1) forwards; }
@keyframes mOverlayOut { to { opacity: 0; } }
@keyframes mWindowOut  { to { opacity: 0; transform: translateY(10px) scale(.97); } }