@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@600;700&display=swap');

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
  background: linear-gradient(180deg, #141B2E 0%, #101627 100%);
  color: #fff;
  min-height: 100vh;
}

a { text-decoration: none; }

/* Auth */
.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  min-height: 100vh;
  background:
    radial-gradient(560px 320px at 50% -10%, rgba(91,110,245,0.16), transparent 70%),
    linear-gradient(180deg, #141B2E 0%, #0E1424 100%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: linear-gradient(180deg, #1E2848 0%, #1A2340 100%);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 18px;
  padding: 36px 32px 32px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.55), 0 0 0 1px rgba(255,255,255,0.02) inset;
  position: relative;
  overflow: hidden;
}
.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #5B6EF5, #8B7CF6, #5B6EF5);
}
.auth-logo { display: flex; align-items: center; gap: 11px; margin-bottom: 28px; }
.auth-logo .logo-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 16px; box-shadow: 0 6px 16px -4px rgba(91,110,245,0.6); }
.auth-logo .logo-text { font-size: 20px; }
.auth-card h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 19px;
  margin: 0 0 5px;
  font-weight: 600;
  color: #fff;
}
.auth-sub {
  margin: 0 0 22px;
  font-size: 13px;
  color: #8B93AC;
  line-height: 1.5;
}
.auth-card label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: #8B93AC;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 7px;
}
.auth-card label:first-of-type { margin-top: 0; }
.auth-card input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.045);
  color: #fff;
  font-size: 14px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.auth-card input:focus {
  outline: none;
  border-color: #5B6EF5;
  background: rgba(91,110,245,0.08);
}
.auth-card .btn-primary {
  margin-top: 24px;
  padding: 13px 16px;
  font-size: 14.5px;
  box-shadow: 0 10px 24px -10px rgba(91,110,245,0.65);
}
.input-wrap { position: relative; }
.input-wrap input { padding-right: 42px; }
.eye-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: #8B93AC;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}
.eye-toggle:hover { color: #C7CDE0; background: rgba(255,255,255,0.06); }
.auth-footnote {
  margin: 20px 0 0;
  text-align: center;
  font-size: 11.5px;
  color: #545C77;
}
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 4px; }
.alert-error { background: rgba(248,113,113,0.12); color: #F87171; border: 1px solid rgba(248,113,113,0.3); }

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand { display: flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: #5B6EF5; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Space Grotesk', sans-serif;
}
.logo-text { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 19px; letter-spacing: -0.3px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.pill { font-size: 13px; color: #AEB6CC; padding: 7px 14px; border-radius: 8px; background: rgba(255,255,255,0.06); }

/* Layout */
.wrap { max-width: 1080px; margin: 0 auto; padding: 32px 24px 64px; }
.panel {
  background: #1C2540;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.07);
  padding: 28px;
}
.panel + .panel { margin-top: 24px; }
.create-panel { display: grid; grid-template-columns: 1.15fr 1fr; gap: 32px; }
@media (max-width: 800px) { .create-panel { grid-template-columns: 1fr; } }

h2 { font-family: 'Space Grotesk', sans-serif; font-size: 20px; font-weight: 600; margin: 0 0 4px; }
h3 { font-family: 'Space Grotesk', sans-serif; font-size: 17px; font-weight: 600; margin: 0; }
.sub { font-size: 13.5px; color: #8B93AC; margin: 0 0 20px; }

/* Form */
#linkForm { display: flex; flex-direction: column; gap: 14px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 500px) { .row2 { grid-template-columns: 1fr; } }

input[type=text], input[type=url], textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: #fff;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: #8B93AC; }
textarea { resize: vertical; min-height: 70px; }

.btn {
  padding: 11px 18px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: #C7CDE0;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
}
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, #5B6EF5, #4457E0);
  border: none;
  color: #fff;
  font-weight: 600;
  padding: 13px 16px;
  flex: 1;
}
.btn-ghost { background: transparent; }
.btn-dashed {
  border: 1px dashed rgba(255,255,255,0.22);
  background: rgba(255,255,255,0.03);
  color: #C7CDE0;
  font-size: 13.5px;
  padding: 11px 16px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.form-actions { display: flex; gap: 10px; margin-top: 4px; }
.upload-status { font-size: 12.5px; color: #4ADE80; display: flex; align-items: center; gap: 6px; }
.upload-status.error { color: #F87171; }

/* Preview */
.label-caps { font-size: 12.5px; font-weight: 600; color: #8B93AC; text-transform: uppercase; letter-spacing: 0.5px; margin: 0 0 10px; }
.preview-frame { background: #0F1526; border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 14px; }
.preview-image {
  height: 170px; border-radius: 10px 10px 0 0; background: #E7E9F2 center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: #A6ACC2; font-size: 12px;
}
.preview-body { background: #fff; border-radius: 0 0 10px 10px; padding: 12px 14px; }
.preview-host { margin: 0 0 4px; font-size: 11px; color: #8B93AC; text-transform: uppercase; letter-spacing: 0.4px; }
.preview-title { margin: 0 0 4px; font-size: 14.5px; font-weight: 600; color: #141B2E; line-height: 1.3; }
.preview-desc { margin: 0; font-size: 12.5px; color: #5A6178; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hint { font-size: 11.5px; color: #6A7290; line-height: 1.5; margin: 10px 2px 0; }

/* List */
.list-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.search-wrap input { width: 240px; }
.link-row {
  display: flex; gap: 14px; padding: 14px 16px; border-radius: 12px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); margin-bottom: 10px;
}
.link-thumb {
  width: 56px; height: 56px; border-radius: 8px; flex-shrink: 0;
  background: rgba(255,255,255,0.06) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; color: #5A6178; font-size: 10px;
}
.link-main { flex: 1; min-width: 0; }
.link-title { margin: 0 0 3px; font-size: 14.5px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.link-slug { color: #5B6EF5; font-size: 13px; font-weight: 500; }
.link-clicks { font-size: 11.5px; color: #4ADE80; background: rgba(74,222,128,0.1); padding: 2px 8px; border-radius: 999px; }
.link-dest { margin: 0; font-size: 12px; color: #6A7290; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-actions { display: flex; gap: 6px; align-items: flex-start; flex-shrink: 0; }
.icon-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04); color: #C7CDE0; cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: 13px;
}
.icon-btn.danger { color: #F87171; }
.icon-btn.success { color: #4ADE80; }
.empty-state { text-align: center; padding: 40px 0; color: #6A7290; font-size: 14px; }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #fff; color: #141B2E; padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  opacity: 0; transition: all 0.25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
