/* ==========================================================================
   Korniza: shiriti anesor i erret, koka, permbajtja, paleta e komandave
   dhe ekrani i hyrjes.
   ========================================================================== */

.shell {
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns var(--t-slow) var(--ease);
}

.shell.is-rail { grid-template-columns: var(--side-w-rail) minmax(0, 1fr); }

/* ------------------------------------------------------------ shiriti anesor */

.side {
  position: sticky;
  top: 0;
  z-index: var(--z-side);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(99, 102, 241, 0.22), transparent 60%),
    linear-gradient(180deg, var(--side-bg-2), var(--side-bg));
  color: var(--side-ink);
  border-right: 1px solid var(--side-line);
  overflow: hidden;
}

.side-brand {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: var(--top-h);
  padding: 0 var(--s-5);
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: linear-gradient(145deg, #6d67ff, #4f46e5 55%, #3b2fc9);
  color: #fff;
  font-weight: 800;
  font-size: 17px;
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  flex: 0 0 auto;
}

.brand-text { display: grid; line-height: 1.15; min-width: 0; }
.brand-name { color: var(--side-ink-strong); font-weight: 800; font-size: var(--fs-lg); letter-spacing: -0.02em; }
.brand-sub { color: var(--side-muted); font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }

.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--s-3) var(--s-3) var(--s-4); }
.side-group + .side-group { margin-top: var(--s-5); }

.side-group-title {
  padding: 0 var(--s-3) var(--s-2);
  color: var(--side-muted);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.side-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: 40px;
  padding: 0 var(--s-3);
  border-radius: var(--r);
  color: var(--side-ink);
  font-size: var(--fs-sm);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease);
}

.side-link + .side-link { margin-top: 2px; }
.side-link svg { width: 19px; height: 19px; flex: 0 0 auto; opacity: 0.85; }
.side-link:hover { background: var(--side-hover); color: var(--side-ink-strong); }

.side-link.is-active {
  background: var(--side-active);
  color: var(--side-ink-strong);
}

.side-link.is-active svg { color: var(--side-accent); opacity: 1; }

.side-link.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--side-accent);
  box-shadow: 0 0 12px var(--side-accent);
}

.side-link-label { overflow: hidden; text-overflow: ellipsis; }

.side-badge {
  margin-left: auto;
  min-width: 22px;
  padding: 2px 7px;
  border-radius: var(--r-full);
  background: #f59e0b;
  color: #1a1203;
  font-size: var(--fs-2xs);
  font-weight: 800;
  text-align: center;
}

.side-switch { padding: var(--s-3) var(--s-4); border-top: 1px solid var(--side-line); flex: 0 0 auto; }

.side-switch-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 3px;
  border-radius: var(--r);
  background: rgba(255, 255, 255, 0.05);
}

.side-switch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  border-radius: var(--r-sm);
  color: var(--side-ink);
  font-size: var(--fs-xs);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.side-switch-btn svg { width: 14px; height: 14px; }
.side-switch-btn:hover { color: var(--side-ink-strong); background: var(--side-hover); }
.side-switch-btn.is-active { background: rgba(255, 255, 255, 0.12); color: var(--side-ink-strong); }

.side-foot {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--side-line);
  flex: 0 0 auto;
}

.side-user { display: grid; line-height: 1.25; min-width: 0; flex: 1; }
.side-user-name { color: var(--side-ink-strong); font-size: var(--fs-sm); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-meta { color: var(--side-muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side .icon-btn { color: var(--side-ink); }
.side .icon-btn:hover { background: var(--side-hover); color: var(--side-ink-strong); }

/* ---- shiriti i ngushte (vetem ikona) ---- */

.shell.is-rail .side-brand { padding: 0; justify-content: center; }
.shell.is-rail .brand-text,
.shell.is-rail .side-link-label,
.shell.is-rail .side-group-title,
.shell.is-rail .side-switch,
.shell.is-rail .side-user,
.shell.is-rail .side-foot .icon-btn { display: none; }
.shell.is-rail .side-nav { padding-left: var(--s-3); padding-right: var(--s-3); }
.shell.is-rail .side-link { justify-content: center; padding: 0; }
.shell.is-rail .side-group + .side-group { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--side-line); }
.shell.is-rail .side-badge { position: absolute; top: 3px; right: 3px; min-width: 18px; padding: 1px 4px; }
.shell.is-rail .side-foot { justify-content: center; padding: var(--s-3) 0; }
.shell.is-rail .side { overflow: visible; }
.shell.is-rail .side-nav { overflow: visible; }

/* ------------------------------------------------------------------ koka */

.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-top);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  height: var(--top-h);
  padding: 0 var(--s-6);
  background: color-mix(in srgb, var(--canvas) 82%, transparent);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}

.topbar-crumbs { display: flex; align-items: center; gap: var(--s-2); min-width: 0; font-size: var(--fs-sm); color: var(--ink-3); font-weight: 600; }
.topbar-crumbs svg { width: 14px; height: 14px; flex: 0 0 auto; }
.topbar-crumbs .is-current { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search-trigger {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  width: min(340px, 34vw);
  height: 38px;
  padding: 0 6px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--ink-3);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}

.search-trigger:hover { border-color: var(--ink-3); }
.search-trigger svg { width: 16px; height: 16px; flex: 0 0 auto; }
.search-trigger > span:not(.kbd) { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.kbd {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-family: var(--font);
  font-size: var(--fs-2xs);
  font-weight: 700;
  white-space: nowrap;
}

.theme-switch { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-3); }
.theme-switch button { display: grid; place-items: center; width: 30px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-3); }
.theme-switch button svg { width: 15px; height: 15px; }
.theme-switch button:hover { color: var(--ink); }
.theme-switch button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-1); }

.user-btn {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  height: 40px;
  padding: 0 8px 0 4px;
  border: 1px solid transparent;
  border-radius: var(--r-full);
  background: transparent;
  color: var(--ink);
}

.user-btn:hover, .user-btn[aria-expanded="true"] { background: var(--surface); border-color: var(--line); }
.user-btn svg { width: 14px; height: 14px; color: var(--ink-3); }
.user-btn-name { font-size: var(--fs-sm); font-weight: 600; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.user-menu { right: 0; top: calc(100% + 8px); }
.user-menu-head { display: flex; align-items: center; gap: var(--s-3); padding: 10px; }
.user-menu-head strong { display: block; font-size: var(--fs-sm); }
.user-menu-head span { display: block; font-size: var(--fs-xs); color: var(--ink-3); }

.bell-dot {
  position: absolute;
  top: 5px;
  right: 5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border: 2px solid var(--canvas);
  border-radius: var(--r-full);
  background: #f59e0b;
  color: #1a1203;
  font-size: 10px;
  font-weight: 800;
  line-height: 13px;
  text-align: center;
  pointer-events: none;
}

.content {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-7) var(--s-8) var(--s-12);
  animation: page-in var(--t-slow) var(--ease-out);
}

@keyframes page-in { from { opacity: 0; transform: translateY(6px); } }

.only-mobile { display: none !important; }

/* ------------------------------------------------------ paleta e komandave */

.palette-wrap { position: fixed; inset: 0; z-index: var(--z-overlay); display: flex; justify-content: center; align-items: flex-start; padding: 12vh var(--s-4) var(--s-4); background: var(--overlay); backdrop-filter: blur(3px); animation: fade-in var(--t) var(--ease); }

.palette {
  width: min(620px, 100%);
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--sh-4);
  overflow: hidden;
  animation: dialog-in var(--t) var(--ease-out);
}

.palette-input { display: flex; align-items: center; gap: var(--s-3); padding: 0 var(--s-5); border-bottom: 1px solid var(--line); }
.palette-input svg { width: 20px; height: 20px; color: var(--ink-3); flex: 0 0 auto; }
.palette-input input { flex: 1; height: 60px; border: 0; background: transparent; font-size: var(--fs-lg); color: var(--ink); outline: none; }

.palette-list { overflow-y: auto; padding: var(--s-2); }
.palette-group { padding: 10px 12px 6px; font-size: var(--fs-2xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }

.palette-item {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--ink);
  font-size: var(--fs-md);
  font-weight: 500;
  text-align: left;
}

.palette-item-icon { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink-2); flex: 0 0 auto; }
.palette-item-icon svg { width: 16px; height: 16px; }
.palette-item-hint { margin-left: auto; font-size: var(--fs-xs); color: var(--ink-3); }
.palette-item.is-active { background: var(--brand-soft); color: var(--brand-ink); }
.palette-item.is-active .palette-item-icon { background: var(--brand-solid); color: #fff; }
.palette-empty { padding: var(--s-8) var(--s-4); text-align: center; color: var(--ink-3); font-size: var(--fs-sm); }
.palette-foot { display: flex; gap: var(--s-4); padding: 10px var(--s-5); border-top: 1px solid var(--line); background: var(--surface-2); font-size: var(--fs-xs); color: var(--ink-3); }
.palette-foot span { display: inline-flex; align-items: center; gap: 6px; }

/* ------------------------------------------------------------- hyrja */

.login {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  min-height: 100vh;
  background: var(--canvas);
}

.login-art {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--s-10) var(--s-12);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(80% 60% at 10% 10%, rgba(124, 108, 240, 0.55), transparent 60%),
    radial-gradient(70% 50% at 90% 90%, rgba(45, 212, 191, 0.25), transparent 60%),
    linear-gradient(160deg, #141833, #0a0c17);
}

/* Rrjeta e holle e sfondit: vetem dekor, pa kuptim. */
.login-art::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

.login-art > * { position: relative; }
.login-brand { display: flex; align-items: center; gap: var(--s-3); font-weight: 800; font-size: var(--fs-xl); letter-spacing: -0.02em; }
.login-pitch { max-width: 520px; }
.login-eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid rgba(255, 255, 255, 0.16); border-radius: var(--r-full); background: rgba(255, 255, 255, 0.06); font-size: var(--fs-xs); font-weight: 600; color: #d6d8f5; }
.login-eyebrow svg { width: 14px; height: 14px; }
.login-pitch h2 { margin: var(--s-5) 0 var(--s-4); font-size: clamp(1.8rem, 3vw, 2.6rem); font-weight: 800; line-height: 1.12; letter-spacing: -0.035em; }
.login-pitch p { color: #b9bcdc; font-size: var(--fs-lg); line-height: 1.6; }
.login-points { display: grid; gap: var(--s-3); margin-top: var(--s-8); }
.login-point { display: flex; align-items: center; gap: var(--s-3); color: #dfe1f7; font-size: var(--fs-md); font-weight: 500; }
.login-point span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r); background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.1); flex: 0 0 auto; }
.login-point svg { width: 17px; height: 17px; color: #a5abff; }
.login-foot { color: #8a8fb5; font-size: var(--fs-xs); }

.login-main { display: grid; place-items: center; padding: var(--s-8) var(--s-6); }
.login-card { width: 100%; max-width: 400px; }
.login-card h1 { margin: 0; font-size: var(--fs-2xl); font-weight: 800; letter-spacing: -0.03em; }
.login-card .lead { margin: var(--s-2) 0 var(--s-8); color: var(--ink-2); font-size: var(--fs-md); }
.login-card .btn { width: 100%; }
.login-hint { display: flex; align-items: flex-start; gap: var(--s-2); margin-top: var(--s-6); padding: var(--s-3) var(--s-4); border: 1px dashed var(--line-strong); border-radius: var(--r); color: var(--ink-3); font-size: var(--fs-xs); line-height: 1.5; }
.login-hint svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.login-back { margin-top: var(--s-5); text-align: center; font-size: var(--fs-sm); }
.login-back a { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-3); font-weight: 600; }
.login-back a:hover { color: var(--brand); }
.login-back svg { width: 14px; height: 14px; }
.login-card .btn svg { width: 18px; height: 18px; }
.login-mobile-brand { display: none; align-items: center; gap: var(--s-3); margin-bottom: var(--s-8); font-weight: 800; font-size: var(--fs-lg); }

.password-field { position: relative; }
.password-field .input { padding-right: 44px; }
.password-field .icon-btn { position: absolute; right: 3px; top: 50%; transform: translateY(-50%); }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1024px) {
  .shell, .shell.is-rail { grid-template-columns: minmax(0, 1fr); }

  .side {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    transform: translateX(-105%);
    transition: transform var(--t-slow) var(--ease-out);
    box-shadow: var(--sh-4);
  }

  .shell.is-open .side { transform: none; }

  /* Ne celular shiriti eshte gjithmone i plote. */
  .shell.is-rail .brand-text,
  .shell.is-rail .side-link-label,
  .shell.is-rail .side-group-title,
  .shell.is-rail .side-user,
  .shell.is-rail .side-foot .icon-btn { display: revert; }
  .shell.is-rail .side-switch { display: block; }
  .shell.is-rail .side-brand { justify-content: flex-start; padding: 0 var(--s-5); }
  .shell.is-rail .side-link { justify-content: flex-start; padding: 0 var(--s-3); }
  .shell.is-rail .side-foot { justify-content: flex-start; padding: var(--s-3) var(--s-4); }
  .shell.is-rail .side-badge { position: static; }

  .side-scrim { position: fixed; inset: 0; z-index: calc(var(--z-side) - 1); background: var(--overlay); animation: fade-in var(--t) var(--ease); }
  .only-mobile { display: inline-grid !important; }
  .only-desktop { display: none !important; }
  .topbar { padding: 0 var(--s-4); }
  .content { padding: var(--s-5) var(--s-4) var(--s-10); }
}

@media (max-width: 900px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .login-mobile-brand { display: flex; }
}

@media (max-width: 640px) {
  .search-trigger { width: 40px; padding: 0; justify-content: center; }
  .search-trigger span, .search-trigger .kbd { display: none; }
  .user-btn-name, .user-btn > svg { display: none; }
  .theme-switch { display: none; }
  .toast-stack { right: var(--s-4); }
}
