:root { color-scheme: dark; }
* { box-sizing: border-box; }

html, body { height: 100%; }

body{
  margin: 0;
  font-family: system-ui, sans-serif;
  background: #0f172a;
  color: #e5e7eb;
  overflow: hidden; /* aby scrolloval jen main, ne celá stránka */
}

.hidden { display: none !important; }
.small { font-size: 0.85rem; }
.muted { color: #94a3b8; }
.msg { margin-top: .75rem; min-height: 1.2rem; }

/* ===== AUTH ===== */
.auth{
  max-width: 520px;
  margin: 4rem auto;
  padding: 0 1rem;
  overflow: auto;
  max-height: calc(100vh - 4rem);
}

.tabs{ display:flex; gap:.5rem; margin: 1rem 0; }
.tab{
  padding:.6rem 1rem;
  border-radius: 10px;
  border:1px solid #1e293b;
  background:#020617;
  color:#e5e7eb;
  cursor:pointer;
}
.tab.active{ background:#111827; border-color:#334155; }

.card{
  background:#020617;
  border:1px solid #1e293b;
  border-radius: 14px;
  padding: 1rem;
  margin: 1rem 0;
}

/* ===== FORM ===== */
input{
  width: 100%;
  padding: .65rem .75rem;
  border-radius: 10px;
  border: 1px solid #334155;
  background: #020617;
  color: #e5e7eb;
  outline: none;
}

button{
  padding: .65rem 1rem;
  border-radius: 10px;
  border: none;
  background: #2563eb;
  color: white;
  cursor: pointer;
}
button:hover{ background:#1d4ed8; }
button.danger{ background:#dc2626; }
button.danger:hover{ background:#b91c1c; }

a{ color:#93c5fd; }

/* ===== APP LAYOUT (pevný sidebar, scrolluje jen main) ===== */
.app{
  display:flex;
  height: 100vh;
}

.sidebar{
  width: 260px;
  padding: 1rem;
  border-right: 1px solid #1e293b;
  background: #0b1224;

  display:flex;
  flex-direction: column;
  gap: .75rem;

  height: 100vh;
  overflow-y: auto;
}

.brand{ font-weight: 800; font-size: 1.2rem; }

.nav{
  display:flex;
  flex-direction: column;
  gap: .5rem;
  margin-top:.5rem;
}

.navbtn{
  text-align:left;
  background: transparent;
  border: 1px solid #1e293b;
  color: #e5e7eb;
}
.navbtn.active{ background:#111827; border-color:#334155; }

.spacer{ flex: 1; }

.main{
  flex: 1;
  padding: 1.25rem 1.5rem;
  height: 100vh;
  overflow-y: auto;
  max-width: none;
  width: 100%;
}

/* ===== COMMON UI ===== */
.row{
  display:flex;
  gap:.5rem;
  flex-wrap: wrap;
}
.row input{ flex: 1 1 200px; }

ul{ margin: .5rem 0 0; padding-left: 1.2rem; }
li{ margin: .35rem 0; }

.bar{
  display:flex;
  align-items:center;
  gap:.5rem;
  margin-bottom: .75rem;
}

/* ===== TILES GRID ===== */
.tiles{
  margin-top: .75rem;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}

.tile{
  border: 1px solid #1e293b;
  border-radius: 14px;
  background:#020617;
  padding: .75rem;
  min-height: 140px;

  display:flex;
  flex-direction: column;
  gap:.5rem;
}

.tileHead{
  display:flex;
  align-items:center;
  gap:.5rem;
  cursor:pointer;
}

.tileTitle{
  font-weight: 700;
  line-height: 1.2;
  word-break: break-word;
}

.tileMeta{
  font-size: .85rem;
  color:#94a3b8;
}

/* ===== THUMBNAILS ===== */
.thumb{
  width: 100%;
  height: 120px;
  border-radius: 12px;
  border: 1px solid #1e293b;
  background: #0b1224;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;
}

.thumb img, .thumb video{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumbIcon{
  font-size: 2rem;
  opacity: .9;
}

/* ===== BUTTON-LIKE LINKS ===== */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;

  padding: .55rem .8rem;
  border-radius: 10px;
  border: 1px solid #1e293b;
  background: #111827;
  color: #e5e7eb;
  text-decoration: none;
  cursor: pointer;
  font-size: .95rem;
}
.btn:hover{ background:#0b1224; }

.btnPrimary{ background:#2563eb; border-color: transparent; color:#fff; }
.btnPrimary:hover{ background:#1d4ed8; }

.btnDanger{ background:#dc2626; border-color: transparent; color:#fff; }
.btnDanger:hover{ background:#b91c1c; }

.actions{ display:flex; gap:.5rem; flex-wrap:wrap; }

/* ===== MODAL PREVIEW ===== */
.modal{
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.modalInner{
  width: min(980px, 100%);
  max-height: 88vh;
  overflow: auto;
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: 16px;
  padding: 1rem;
}

.modalBar{
  display:flex;
  align-items:center;
  gap:.75rem;
  margin-bottom: .75rem;
}

.modalTitle{
  font-weight: 800;
  flex: 1;
}

/* default media in modal (video uses this) */
.modalBody img, .modalBody video{
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid #1e293b;
  background: #0b1224;
}

.modalBody audio{ width: 100%; }

/* ===== IMAGE VIEWER (zoom/pan) ===== */
.viewer{
  width: 100%;
  height: min(75vh, 800px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  border-radius: 14px;
  border: 1px solid #1e293b;
  background: #0b1224;
  overflow: hidden;
}
.viewer:active{ cursor: grabbing; }

.viewer img{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;

  transform-origin: center center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.viewerHelp{
  margin-top: .5rem;
  font-size: .85rem;
  color: #94a3b8;
}

/* ===== ASSIGN VIEW (Rozdělení dědictví) ===== */
.gridAssign{
  display:grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 1rem;
  align-items: start;
}
@media (max-width: 980px){
  .gridAssign{ grid-template-columns: 1fr; }
}

.heirsGrid{
  margin-top: .75rem;
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: .75rem;
}

.heirCard{
  border: 1px solid #1e293b;
  border-radius: 14px;
  background:#020617;
  padding: .75rem;
}

.heirCard.drop{
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37,99,235,.18);
}

.heirHead{
  display:flex;
  align-items: baseline;
  justify-content: space-between;
  gap:.5rem;
}

.heirName{ font-weight: 800; }
.heirMeta{ font-size: .85rem; color:#94a3b8; }

.sectionLabel{
  margin-top:.5rem;
  font-size:.85rem;
  color:#94a3b8;
}

/* chips used in assign view */
.chips{
  display:flex;
  flex-wrap:wrap;
  gap:.35rem;
  margin-top: .35rem;
}

.chip{
  display:inline-flex;
  align-items:center;
  gap:.35rem;
  padding:.2rem .45rem;
  border-radius:999px;
  border:1px solid #334155;
  background:#0b1224;
  font-size:.82rem;
}

.chip button{
  padding: 0 .35rem;
  border-radius:999px;
  background: transparent;
  border:1px solid #334155;
  color:#e5e7eb;
  cursor:pointer;
}
.chip button:hover{ background:#111827; }

/* ===== TEXT PREVIEW ===== */
.textPreview{
  margin: 0;
  padding: .75rem;
  border-radius: 14px;
  border: 1px solid #1e293b;
  background: #0b1224;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: .9rem;
  line-height: 1.35;
  max-height: 70vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.uploadHud{
  border: 1px solid #1e293b;
  border-radius: 14px;
  padding: .75rem;
  background: #020617;
  margin-top: .75rem;
}

.uploadTop{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap:.5rem;
  margin-bottom:.5rem;
}

.uploadBar{
  width:100%;
  height: 10px;
  border-radius: 999px;
  border: 1px solid #1e293b;
  background: #0b1224;
  overflow:hidden;
}

.uploadBarFill{
  height: 100%;
  border-radius: 999px;
  background: #2563eb;
  width: 0%;
  transition: width .08s linear;
}

.pwTable th, .pwTable td { padding: .5rem; }
.pwTable tr:hover td { background: rgba(255,255,255,0.03); }

#pwRows span[id^="pw-plain-"] {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
