/* TaskBoard – modern, letisztult téma */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --border: #e5e8f0;
  --text: #1c2333;
  --muted: #6b7489;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0ff;
  --danger: #e5484d;
  --ok-bg: #e6f8ef; --ok: #17794d;
  --err-bg: #fdecec; --err: #b42327;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20,28,51,.06), 0 1px 1px rgba(20,28,51,.04);
  --shadow: 0 6px 20px rgba(20,28,51,.08);
  --shadow-lg: 0 18px 48px rgba(20,28,51,.18);
  --ring: 0 0 0 3px rgba(79,70,229,.22);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Inter, "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg); color: var(--text); line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: .9rem; }
.row { display: flex; gap: 8px; align-items: center; }

/* egyedi oldalháttér: színes ködfoltok + finom pontrács */
body:not(.board-page):not(.auth) {
  background:
    radial-gradient(900px 520px at 8% -5%, rgba(79,70,229,.20), transparent 65%),
    radial-gradient(760px 520px at 96% 4%, rgba(236,72,153,.16), transparent 65%),
    radial-gradient(900px 600px at 70% 105%, rgba(14,165,233,.16), transparent 65%),
    radial-gradient(rgba(28,35,51,.09) 1px, transparent 1.3px) 0 0 / 22px 22px,
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

/* gombok és mezők */
.btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: var(--radius-sm);
  cursor: pointer; font: inherit; font-weight: 500; font-size: .92rem; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .1s, box-shadow .15s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 0; box-shadow: var(--ring); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.3); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; box-shadow: none; }
.btn.danger:hover { background: #cf3b40; }

input, textarea, select { font: inherit; width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s; }
input::placeholder, textarea::placeholder { color: #9aa2b5; }
input:focus, textarea:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: var(--ring); }
textarea { resize: vertical; }

/* belépés / regisztráció */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(79,70,229,.22), transparent 60%),
    radial-gradient(520px 420px at 90% 90%, rgba(236,72,153,.18), transparent 60%),
    var(--bg); }
.auth-card { background: rgba(255,255,255,.92); backdrop-filter: blur(10px); padding: 36px 32px; border-radius: 20px; width: min(420px, 100%);
  display: grid; gap: 14px; box-shadow: var(--shadow-lg); border: 1px solid rgba(255,255,255,.7); }
.auth-card h1 { margin: 0; text-align: center; font-size: 1.6rem; font-weight: 800; background: linear-gradient(120deg, var(--accent), #ec4899); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-card h2 { margin: 0; text-align: center; font-size: 1.05rem; font-weight: 500; color: var(--muted); }
.auth-card label { display: grid; gap: 6px; font-size: .82rem; font-weight: 600; color: var(--muted); }
.auth-card p { margin: 0; text-align: center; }
.auth-card .btn.primary { padding: 11px 14px; }
.alert { background: var(--err-bg); color: var(--err); border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }

/* felső sáv */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px 20px;
  background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border); color: var(--text); }
.topbar form { margin: 0; }
.topbar [hidden] { display: none; }
.brand { color: var(--text); font-weight: 800; font-size: 1.15rem; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 24px; height: 24px; border-radius: 7px; background: linear-gradient(135deg, var(--accent), #ec4899);
  -webkit-mask: none; box-shadow: 0 3px 8px rgba(79,70,229,.35); }
.brand:hover { text-decoration: none; }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: .92rem; font-weight: 500; padding: 6px 10px; border-radius: var(--radius-sm); }
a.who:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.board-name { margin: 0; font-size: 1.05rem; font-weight: 700; cursor: pointer; padding: 5px 10px; border-radius: var(--radius-sm);
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.board-name:hover { background: var(--surface-2); }

/* táblák listája */
.container { max-width: 1040px; margin: 0 auto; padding: 36px 20px; }
.container > h2 { font-size: 1.6rem; margin: 0 0 20px; font-weight: 800; }
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.board-tile { position: relative; border-radius: var(--radius); min-height: 124px; color: #fff; overflow: hidden; box-shadow: var(--shadow); }
.board-tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(160deg, rgba(255,255,255,.18), rgba(0,0,0,.28)); pointer-events: none; }
.tile-link { position: relative; z-index: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; height: 100%; min-height: 124px; padding: 16px; color: #fff; }
.tile-link:hover { text-decoration: none; }
.tile-link strong { font-size: 1.08rem; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.tile-link small { opacity: .9; font-size: .8rem; }
.tile-del { position: absolute; z-index: 2; top: 10px; right: 10px; width: 28px; height: 28px; border: 0; background: rgba(0,0,0,.35); color: #fff; border-radius: 8px; cursor: pointer; opacity: 0; transition: opacity .15s, background .15s; }
.tile-del:hover { background: var(--danger); }
.board-tile:hover .tile-del { opacity: 1; }
.board-tile.new { background: var(--surface); color: var(--text); padding: 16px; display: grid; gap: 10px; align-content: center; border: 1px dashed #c9cfe0; box-shadow: none; }
.board-tile.new::after { display: none; }
.board-tile.new input[type=color] { width: 46px; height: 40px; padding: 3px; cursor: pointer; }
.board-tile.new .row { gap: 10px; }
.board-tile.new .btn.primary { flex: 1; }

/* tábla nézet */
body.board-page { background: var(--board, #4f46e5); height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
body.board-page:not(.has-bg) { background: linear-gradient(135deg, var(--board, #4f46e5), color-mix(in srgb, var(--board, #4f46e5) 55%, #000)); }
body.board-page.has-bg { background: var(--bg-img) center / cover no-repeat fixed; }
.board-page .topbar { background: rgba(255,255,255,.78); }
.lists { flex: 1; display: flex; gap: 14px; padding: 20px; overflow-x: auto; align-items: flex-start; }
.list { background: rgba(244,246,251,.92); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,.5); border-radius: var(--radius);
  width: 290px; flex: none; padding: 10px; max-height: 100%; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; }
.list-title { margin: 0; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); cursor: pointer; flex: 1; }
.list-title:hover { color: var(--text); }
.icon-btn { border: 0; background: transparent; cursor: pointer; color: #9aa2b5; border-radius: 8px; width: 28px; height: 28px; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--err-bg); color: var(--danger); }
.cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 28px; padding: 2px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow-sm);
  cursor: pointer; word-break: break-word; font-size: .94rem; transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d3d8e8; }
.card.colored { border-color: color-mix(in srgb, var(--c) 40%, #fff); box-shadow: inset 5px 0 0 var(--c), var(--shadow-sm);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 48%, #fff) 0%, color-mix(in srgb, var(--c) 22%, #fff) 55%, color-mix(in srgb, var(--c) 6%, #fff) 100%); }
.card.colored:hover { box-shadow: inset 5px 0 0 var(--c), var(--shadow);
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 58%, #fff) 0%, color-mix(in srgb, var(--c) 30%, #fff) 55%, color-mix(in srgb, var(--c) 10%, #fff) 100%); }
.card.colored .badge { background: rgba(255,255,255,.7); }

/* színes lista + lista funkciók */
.list { position: relative; }
.list.colored { background: linear-gradient(180deg, color-mix(in srgb, var(--c) 32%, #f4f6fb) 0, color-mix(in srgb, var(--c) 8%, #f4f6fb) 140px, rgba(244,246,251,.94) 100%); }
.list.colored::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; border-radius: var(--radius) var(--radius) 0 0;
  background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 35%, #fff)); }
.list-head { cursor: grab; touch-action: pan-x pan-y; user-select: none; -webkit-user-select: none; gap: 6px; }
.list-title { cursor: pointer; }
.count { font-size: .72rem; font-weight: 700; color: var(--muted); background: rgba(28,35,51,.07); border-radius: 999px; padding: 1px 8px; min-width: 22px; text-align: center; }
.list.colored .count { background: rgba(255,255,255,.7); }
.menu-btn { font-size: 1.15rem; line-height: 1; }
.menu-btn:hover { background: rgba(28,35,51,.08); color: var(--text); }
.list-ghost { position: fixed !important; z-index: 100; pointer-events: none; margin: 0; opacity: .95; box-shadow: var(--shadow-lg); animation: none !important; overflow: hidden; }
.list-placeholder { flex: none; border-radius: var(--radius); background: rgba(255,255,255,.35); border: 2px dashed rgba(255,255,255,.85); }

.menu { position: fixed; z-index: 90; width: 252px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 8px; box-shadow: var(--shadow-lg); animation: menuIn .14s ease; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
.menu-item { display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 9px 10px; border-radius: 9px; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; white-space: pre; }
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item.danger:hover { background: var(--err-bg); }
.menu-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px 4px; }
.menu-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.menu-swatches { padding: 4px 10px 8px; gap: 8px; }
.menu-swatches .swatch { width: 24px; height: 24px; }
.card-title { font-weight: 500; }
.badges { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.badge { font-size: .74rem; color: var(--muted); background: var(--surface-2); padding: 2px 8px; border-radius: 999px; }
.badge.overdue { color: #fff; background: var(--danger); }
.add-form { margin-top: 8px; }
.add-form input { border-color: transparent; background: transparent; color: var(--muted); }
.add-form input:hover { background: rgba(28,35,51,.05); }
.add-form input:focus { background: var(--surface); border-color: var(--accent); color: var(--text); }
.add-list { background: rgba(255,255,255,.4); border: 1px dashed rgba(255,255,255,.8); box-shadow: none; }
.add-list input { background: rgba(255,255,255,.75); border-color: transparent; }

/* húzás */
.card.ghost { position: fixed; z-index: 100; pointer-events: none; margin: 0; opacity: .95; box-shadow: var(--shadow-lg); transition: none; animation: none; }
.card-placeholder { border-radius: var(--radius-sm); background: var(--accent-soft); border: 2px dashed rgba(79,70,229,.45); }
body.is-dragging { cursor: grabbing; user-select: none; }
body.is-dragging .lists { scroll-snap-type: none; }

/* admin */
.container.wide { max-width: 1120px; }
.container.wide > h2:not(:first-child) { margin-top: 36px; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }
th { background: var(--surface-2); color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
tbody tr:hover td, tr:hover > td { background: #fafbfe; }
td.actions { white-space: nowrap; text-align: right; }
td.actions .btn + .btn, td.actions form + form { margin-left: 6px; }
form.inline { display: inline; margin: 0; }
.btn.small { padding: 5px 11px; font-size: .8rem; }
.pill { background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 2px 9px; font-size: .7rem; font-weight: 700; }

/* kártyaszín-választó */
.label-text { font-weight: 600; font-size: .82rem; color: var(--muted); margin-bottom: 8px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--border); cursor: pointer;
  transition: transform .15s, box-shadow .15s; font: inherit; color: var(--muted); background: var(--surface-2); padding: 0; }
.swatch:hover { transform: scale(1.15); }
.swatch.custom { position: relative; overflow: hidden; cursor: pointer; display: inline-block;
  background: conic-gradient(#ef4444, #f59e0b, #eab308, #22c55e, #06b6d4, #3b82f6, #8b5cf6, #ec4899, #ef4444); }
.swatch.custom input[type=color] { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); padding: 0; border: 0; opacity: 0; cursor: pointer; }
.swatch.sel { box-shadow: 0 0 0 2px var(--text); transform: scale(1.1); }

/* felugró ablak */
.modal { position: fixed; inset: 0; background: rgba(20,28,51,.5); backdrop-filter: blur(3px); display: flex; justify-content: center; align-items: flex-start; padding-top: 8vh; z-index: 50; }
.modal[hidden] { display: none; }
.modal-box { position: relative; background: var(--surface); width: min(580px, 94vw); border-radius: 18px; padding: 28px; display: grid; gap: 16px; box-shadow: var(--shadow-lg); }
.modal-box label { display: grid; gap: 6px; font-weight: 600; font-size: .82rem; color: var(--muted); }
.modal-box .row { margin-top: 4px; }
.modal-box .row .btn.danger { margin-left: auto; }
.modal-close { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; cursor: pointer; font-size: 1rem; color: var(--muted); }
.modal-close:hover { background: var(--surface-2); color: var(--text); }

/* animációk */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.8); } 60% { transform: scale(1.04); } 100% { opacity: 1; transform: scale(1); } }
@keyframes modalIn { from { opacity: 0; transform: translateY(-16px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.list { animation: fadeUp .4s ease both; }
.list:nth-child(2) { animation-delay: .05s; } .list:nth-child(3) { animation-delay: .1s; }
.list:nth-child(4) { animation-delay: .15s; } .list:nth-child(5) { animation-delay: .2s; }
.list:nth-child(n+6) { animation-delay: .25s; }
.card.pop { animation: popIn .35s ease; }
.board-tile { transition: transform .2s ease, box-shadow .2s ease; animation: fadeUp .4s ease both; }
.board-tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.modal { animation: fadeIn .2s ease; }
.modal-box { animation: modalIn .25s ease; }
.alert, .auth-card { animation: fadeUp .35s ease both; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* reszponzív */
@media (hover: none) {
  .tile-del { opacity: 1; }
  .card:hover { transform: none; box-shadow: var(--shadow-sm); border-color: var(--border); }
}
@media (max-width: 720px) {
  input, textarea, select { font-size: 16px; }   /* iOS ne nagyítson mezőre kattintáskor */
  .topbar { padding: 8px 12px; gap: 6px; }
  .topbar .btn { padding: 6px 10px; font-size: .85rem; }
  .brand { font-size: 1rem; }
  .board-name { order: 10; flex-basis: 100%; max-width: none; font-size: 1rem; padding: 2px 4px; }
  .spacer { display: none; }
  .who { margin-left: auto; font-size: .85rem; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .container { padding: 22px 14px; }
  .container > h2 { font-size: 1.35rem; }
  .board-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .board-tile, .tile-link { min-height: 104px; }
  .lists { padding: 12px; gap: 12px; scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; }
  .list { width: 84vw; scroll-snap-align: center; }
  .modal { padding-top: 0; align-items: flex-end; }
  .modal-box { width: 100%; max-height: 92vh; max-height: 92dvh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 22px 18px 26px; animation: sheetIn .25s ease; }
  .modal-close { width: 38px; height: 38px; font-size: 1.2rem; }
  .swatch { width: 38px; height: 38px; }
  .auth-card { padding: 26px 20px; }
  th, td { padding: 10px; }
  td.actions { white-space: normal; }
}
