/* =========================
   My Links — polished UI
   Pure CSS, no frameworks
   ========================= */

:root{
  --bg: #070A12;
  --panel: rgba(255,255,255,.06);
  --panel2: rgba(255,255,255,.08);
  --stroke: rgba(255,255,255,.12);
  --text: rgba(255,255,255,.92);
  --muted: rgba(255,255,255,.65);
  --shadow: 0 18px 55px rgba(0,0,0,.55);
  --shadow2: 0 10px 28px rgba(0,0,0,.40);
  --radius: 18px;
  --radius2: 14px;
  --pad: clamp(14px, 2.8vw, 22px);
  --max: 720px;
  --focus: 0 0 0 3px rgba(124,58,237,.45);
  --ease: cubic-bezier(.2,.8,.2,1);
}

*{ box-sizing: border-box; }
html,body{ height: 100%; }
body{
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji","Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* Background */
.bg{ position: fixed; inset: 0; z-index: -1; overflow:hidden; }
.bg__blob{
  position:absolute;
  width: 62vmax; height: 62vmax;
  filter: blur(50px);
  opacity: .7;
  transform: translate3d(0,0,0);
  animation: floaty 14s var(--ease) infinite alternate;
}
.bg__blob--a{ left:-20vmax; top:-22vmax; background: radial-gradient(circle at 30% 30%, #7c3aed, transparent 60%), radial-gradient(circle at 70% 60%, #22c55e, transparent 62%); }
.bg__blob--b{ right:-26vmax; bottom:-24vmax; background: radial-gradient(circle at 30% 30%, #06b6d4, transparent 60%), radial-gradient(circle at 60% 70%, #f97316, transparent 62%); animation-duration: 18s; }
.bg__grid{
  position:absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 40%, rgba(0,0,0,1) 0%, rgba(0,0,0,.0) 70%);
  opacity: .35;
}

@keyframes floaty{
  from{ transform: translate(-2%, -1%) scale(1); }
  to{ transform: translate(2%, 3%) scale(1.05); }
}

/* Layout */
.shell{
  width: min(var(--max), calc(100% - 28px));
  margin: 34px auto 56px;
  display: grid;
  gap: 18px;
}

.hero{
  display:flex;
  align-items:center;
  gap: 14px;
  padding: var(--pad);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.04));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
}
.hero__avatar{
  width: 58px; height: 58px;
  border-radius: 16px;
  display:flex; align-items:center; justify-content:center;
  font-weight: 800; letter-spacing: .02em;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), rgba(255,255,255,.06) 60%), linear-gradient(135deg, rgba(124,58,237,.55), rgba(6,182,212,.35));
  border: 1px solid rgba(255,255,255,.18);
  box-shadow: 0 10px 25px rgba(0,0,0,.35);
}
.hero__title{ margin: 0; font-size: clamp(20px, 3.2vw, 28px); }
.hero__bio{ margin: 3px 0 0; color: var(--muted); line-height: 1.35; }

.card{
  padding: var(--pad);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(255,255,255,.04));
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow2);
  backdrop-filter: blur(10px);
}

.card__header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.card__title{ margin:0; font-size: 16px; letter-spacing:.02em; color: rgba(255,255,255,.88); }

.links{ display:grid; gap: 12px; }
.linkbtn{
  display:flex;
  align-items:center;
  gap: 12px;
  width: 100%;
  text-decoration:none;
  color: var(--text);
  padding: 14px 14px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.06));
  border: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 14px 32px rgba(0,0,0,.35);
  transform: translateZ(0);
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
  position: relative;
  overflow:hidden;
}
.linkbtn::before{
  content:"";
  position:absolute; inset:-2px;
  background: radial-gradient(circle at 30% 20%, rgba(124,58,237,.40), transparent 55%),
              radial-gradient(circle at 80% 70%, rgba(6,182,212,.35), transparent 55%);
  opacity: 0;
  transition: opacity .20s var(--ease);
}
.linkbtn:hover{ transform: translateY(-2px); border-color: rgba(255,255,255,.18); box-shadow: 0 18px 40px rgba(0,0,0,.45); }
.linkbtn:hover::before{ opacity: 1; }
.linkbtn:active{ transform: translateY(0px) scale(.995); }
.linkbtn:focus-visible{ outline: none; box-shadow: var(--shadow2), var(--focus); }

.linkbtn__icon{
  width: 42px; height: 42px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  position: relative;
  z-index: 1;
}
.linkbtn__icon svg{ width: 22px; height: 22px; opacity: .95; }
.linkbtn__text{ display:flex; flex-direction:column; gap: 2px; min-width:0; position:relative; z-index:1;}
.linkbtn__title{ font-weight: 700; letter-spacing: .01em; }
.linkbtn__sub{
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
  max-width: 48ch;
}
.linkbtn__chev{
  margin-left:auto;
  opacity:.7;
  font-size: 14px;
  position:relative;
  z-index:1;
  transition: transform .18s var(--ease), opacity .18s var(--ease);
}
.linkbtn:hover .linkbtn__chev{ transform: translateX(2px); opacity: .95; }

.chip{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.86);
  text-decoration:none;
  font-size: 13px;
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease);
}
.chip:hover{ background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.18); transform: translateY(-1px); }
.chip:active{ transform: translateY(0); }
.chip:focus-visible{ outline:none; box-shadow: var(--focus); }

.footer{
  text-align:center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

/* Admin */
.admin .shell{ margin-top: 26px; }
.topbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
}
.topbar__title{ flex:1; }
.h1{ margin:0; font-size: 20px; }
.h2{ margin:0; font-size: 16px; }
.muted{ color: var(--muted); }
.row{ display:flex; gap: 10px; align-items:center; }
.grid2{ display:grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px){
  .grid2{ grid-template-columns: 1fr 1fr; }
}

.field{ display:grid; gap: 8px; }
label{ font-size: 13px; color: rgba(255,255,255,.82); }
input, select{
  width: 100%;
  background: rgba(0,0,0,.18);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 14px;
  padding: 12px 12px;
  outline: none;
  transition: border-color .16s var(--ease), box-shadow .16s var(--ease), background .16s var(--ease);
}
input::placeholder{ color: rgba(255,255,255,.45); }
input:focus, select:focus{ border-color: rgba(124,58,237,.55); box-shadow: var(--focus); background: rgba(0,0,0,.22); }

.hint{ margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.note{
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
}
.note--danger{
  border-color: rgba(248,113,113,.28);
  background: rgba(248,113,113,.06);
}
.kbd{
  padding: 2px 7px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  font-weight: 700;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(255,255,255,.07);
  color: rgba(255,255,255,.92);
  cursor:pointer;
  transition: transform .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease), box-shadow .18s var(--ease);
  user-select:none;
}
.btn:hover{ background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.20); transform: translateY(-1px); }
.btn:active{ transform: translateY(0px); }
.btn:focus-visible{ outline:none; box-shadow: var(--focus); }
.btn--ghost{ background: transparent; }
.btn--danger{
  background: rgba(248,113,113,.14);
  border-color: rgba(248,113,113,.28);
}
.btn--danger:hover{ background: rgba(248,113,113,.18); border-color: rgba(248,113,113,.36); }
.btn__icon{ opacity:.9; }

.table{
  border-radius: 16px;
  overflow:hidden;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.15);
}
.table__head, .table__row{
  display:grid;
  grid-template-columns: 60px 70px 1.2fr 1.6fr 120px 170px;
  gap: 10px;
  padding: 10px 12px;
  align-items:center;
}
.table__head{
  background: rgba(255,255,255,.06);
  color: rgba(255,255,255,.72);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing:.08em;
}
.table__body{ display:grid; }
.table__row{
  border-top: 1px solid rgba(255,255,255,.08);
}
.table__row:hover{ background: rgba(255,255,255,.03); }
.drag{
  cursor: grab;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width: 38px; height: 36px;
  border-radius: 12px;
  border: 1px dashed rgba(255,255,255,.18);
  background: rgba(255,255,255,.05);
  color: rgba(255,255,255,.8);
}
.drag:active{ cursor: grabbing; }
.badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 999px;
  padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  font-size: 12px;
}
.badge--off{
  border-color: rgba(251,191,36,.22);
  background: rgba(251,191,36,.08);
  color: rgba(251,191,36,.95);
}
.iconbox{
  width: 42px; height: 42px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
}
.iconbox svg{ width: 22px; height: 22px; opacity:.95; }
.actions{ display:flex; gap: 8px; justify-content:flex-end; }
.small{
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 13px;
}

/* Modal */
.modal{ position: fixed; inset: 0; display:none; }
.modal[aria-hidden="false"]{ display:block; }
.modal__backdrop{
  position:absolute; inset:0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  animation: fade .16s var(--ease) both;
}
.modal__panel{
  position:relative;
  width: min(560px, calc(100% - 28px));
  margin: 9vh auto 0;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,.14);
  background: linear-gradient(180deg, rgba(255,255,255,.10), rgba(255,255,255,.05));
  box-shadow: var(--shadow);
  animation: pop .18s var(--ease) both;
}
.modal__header, .modal__footer{
  display:flex; align-items:center; justify-content:space-between; gap: 10px;
}
.modal__body{ margin-top: 12px; display:grid; gap: 12px; }
.preview{ margin-top: 6px; }
.preview__label{ font-size: 12px; margin-bottom: 8px; }
.linkbtn--preview{ pointer-events:none; }
@keyframes fade{ from{opacity:0} to{opacity:1} }
@keyframes pop{ from{opacity:0; transform: translateY(10px) scale(.98)} to{opacity:1; transform: translateY(0) scale(1)} }

/* Toast */
.toast{
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,.9);
  font-size: 13px;
  box-shadow: 0 12px 28px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events:none;
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.toast--show{
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .bg__blob{ animation: none; }
  .linkbtn, .chip, .btn{ transition: none; }
  .modal__backdrop, .modal__panel{ animation: none; }
}


/* Themes (apply by setting body[data-theme="..."]) */
body[data-theme="midnight"]{ --bg:#070A12; }
body[data-theme="ocean"]{ --bg:#040B16; }
body[data-theme="sunset"]{ --bg:#12070B; }
body[data-theme="forest"]{ --bg:#06120A; }
body[data-theme="mono"]{
  --bg:#070707;
  --panel: rgba(255,255,255,.05);
  --panel2: rgba(255,255,255,.07);
}

/* Button style variants for public link buttons */
body[data-button-style="glass"] .linkbtn{
  background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,.06));
}
body[data-button-style="solid"] .linkbtn{ background: rgba(255,255,255,.10); }
body[data-button-style="outline"] .linkbtn{
  background: transparent;
  border: 1px solid rgba(255,255,255,.20);
  box-shadow: 0 10px 24px rgba(0,0,0,.25);
}
body[data-button-style="neon"] .linkbtn{
  border-color: rgba(124,58,237,.35);
  box-shadow: 0 0 0 1px rgba(124,58,237,.22), 0 16px 36px rgba(0,0,0,.45);
}
