/* ============================================================
   Klar Start — Liquid Glass · Material 3 Expressive · Firefox Klar
   Geteilt zwischen Start, Login und Admin
   ============================================================ */

:root {
  --bg-base: #0a0612;
  --bg-deep: #050308;

  --glass-bg: rgba(255, 255, 255, 0.045);
  --glass-bg-pressed: rgba(255, 255, 255, 0.085);
  --glass-bg-strong: rgba(255, 255, 255, 0.075);
  --glass-border: rgba(255, 255, 255, 0.10);
  --glass-border-bright: rgba(255, 255, 255, 0.22);

  --text-primary: rgba(255, 255, 255, 0.96);
  --text-secondary: rgba(255, 255, 255, 0.62);
  --text-tertiary: rgba(255, 255, 255, 0.38);

  --accent-magenta: #fb1ff6;
  --accent-purple: #d614c8;
  --accent-orange: #ff7950;
  --accent-success: #10b981;
  --accent-danger: #ef4444;

  --font-display: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  --font-body: 'Funnel Sans', system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  --orb-1-color: rgba(251, 31, 246, 0.45);
  --orb-2-color: rgba(255, 121, 80, 0.32);
}

@property --orb-1-color { syntax: '<color>'; inherits: true; initial-value: rgba(251, 31, 246, 0.45); }
@property --orb-2-color { syntax: '<color>'; inherits: true; initial-value: rgba(255, 121, 80, 0.32); }

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg-deep); }

body {
  min-height: 100dvh;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  background:
    radial-gradient(ellipse 90% 55% at 50% -8%, rgba(251, 31, 246, 0.26), transparent 60%),
    radial-gradient(ellipse 70% 45% at 95% 25%, rgba(255, 121, 80, 0.13), transparent 60%),
    radial-gradient(ellipse 75% 55% at 5% 75%, rgba(214, 20, 200, 0.17), transparent 60%),
    linear-gradient(180deg, var(--bg-base) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  padding:
    calc(var(--safe-top) + 28px)
    20px
    calc(var(--safe-bottom) + 36px);
}

/* ---- Floating orbs ---- */
.ambient-orb {
  position: fixed;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--orb-1-color), transparent 70%);
  filter: blur(70px);
  top: -120px; left: -120px;
  pointer-events: none;
  z-index: 0;
  animation: drift 32s ease-in-out infinite;
  will-change: transform;
  transition: --orb-1-color 4s ease;
}
.ambient-orb.two {
  width: 280px; height: 280px;
  background: radial-gradient(circle, var(--orb-2-color), transparent 70%);
  top: auto; left: auto;
  bottom: -100px; right: -100px;
  animation-duration: 40s;
  animation-direction: reverse;
  transition: --orb-2-color 4s ease;
}
@keyframes drift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(40vw, 25vh) scale(1.15); }
  66%      { transform: translate(15vw, 55vh) scale(0.9); }
}

/* Grain overlay */
body::after {
  content: '';
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='3'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
}

.container {
  max-width: 520px;
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* ============================================================
   Header (Time / Date / Greeting)
   ============================================================ */
.header { text-align: center; margin-bottom: 30px; animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1); }

.time {
  font-family: var(--font-display);
  font-size: clamp(56px, 16vw, 72px);
  font-weight: 500;
  font-variation-settings: "opsz" 72;
  letter-spacing: -0.045em;
  line-height: 0.95;
  background: linear-gradient(180deg, #ffffff 0%, rgba(255,255,255,0.55) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-feature-settings: "tnum" 1;
}

.date {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-top: 14px;
}

.greeting {
  font-size: 15px;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ============================================================
   Glass-Komponenten (shared)
   ============================================================ */
.glass {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 4px 18px rgba(0,0,0,0.22);
}
.glass::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
}

/* ============================================================
   Search Bar
   ============================================================ */
.search-container {
  position: relative;
  margin-bottom: 38px;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.08s backwards;
}
.search-glow {
  position: absolute; inset: -16px;
  background: radial-gradient(ellipse at center, rgba(251, 31, 246, 0.35), transparent 65%);
  filter: blur(18px);
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
  z-index: -1;
}
.search-container:focus-within .search-glow { opacity: 1; }

.search-wrapper {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: 30px;
  overflow: hidden;
  transition: border-color 0.3s ease, background 0.3s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.08),
    inset 0 -1px 0 rgba(0,0,0,0.25),
    0 6px 28px rgba(0,0,0,0.25);
}
.search-wrapper::before {
  content: '';
  position: absolute;
  top: 0; left: 18%; right: 18%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.55), transparent);
  pointer-events: none;
}
.search-wrapper:focus-within {
  border-color: var(--glass-border-bright);
  background: var(--glass-bg-pressed);
}
.search-input {
  width: 100%;
  padding: 19px 76px 19px 56px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  outline: none;
  letter-spacing: 0.005em;
}
.search-input::placeholder { color: var(--text-tertiary); }
.search-icon {
  position: absolute;
  left: 20px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  pointer-events: none;
}
.search-badge {
  position: absolute;
  right: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(251, 31, 246, 0.9);
  background: rgba(251, 31, 246, 0.10);
  border: 1px solid rgba(251, 31, 246, 0.22);
  padding: 5px 9px;
  border-radius: 10px;
  font-weight: 600;
  font-family: var(--font-display);
}

/* ============================================================
   Section title
   ============================================================ */
.section-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  padding-left: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.16s backwards;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--glass-border), transparent);
}
.page-indicator {
  color: var(--accent-magenta);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
  opacity: 0.85;
}
.page-indicator:empty { display: none; }

/* ============================================================
   Pager
   ============================================================ */
.pager {
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  display: flex;
  touch-action: pan-x;
  min-height: 280px;
  margin: 0 -20px;
  padding: 0;
}
.pager::-webkit-scrollbar { display: none; }
.page {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  box-sizing: border-box;
  padding: 0 20px;
}

.links-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 11px;
}

/* ============================================================
   Link card
   ============================================================ */
.link-card {
  position: relative;
  background: var(--glass-bg);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  padding: 16px 16px 14px;
  text-decoration: none;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 78px;
  overflow: hidden;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    background 0.25s ease,
    border-color 0.25s ease;
  animation: fadeUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) backwards;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    inset 0 -1px 0 rgba(0,0,0,0.2),
    0 4px 18px rgba(0,0,0,0.2);
}
.link-card::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
}
.link-card::after {
  content: '';
  position: absolute;
  top: -60%; right: -40%;
  width: 130%; height: 130%;
  background: radial-gradient(circle, var(--card-glow, rgba(251,31,246,0.35)), transparent 65%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.link-card:active {
  transform: scale(0.955);
  background: var(--glass-bg-pressed);
  border-color: var(--glass-border-bright);
}
.link-card:active::after { opacity: 1; }

.link-icon {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: var(--icon-bg, linear-gradient(135deg, #fb1ff6, #ff7950));
  flex-shrink: 0;
  letter-spacing: -0.02em;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    inset 0 -1px 0 rgba(0,0,0,0.15),
    0 4px 12px var(--icon-shadow, rgba(251,31,246,0.3));
  text-shadow: 0 1px 1px rgba(0,0,0,0.15);
}
.link-icon img {
  width: 100%; height: 100%;
  border-radius: 14px;
  object-fit: cover;
}

.link-text {
  display: flex; flex-direction: column;
  gap: 3px; min-width: 0; flex: 1;
}
.link-title {
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: -0.005em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.2;
}
.link-domain {
  font-size: 11.5px;
  color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ============================================================
   Page dots
   ============================================================ */
.page-dots {
  display: flex;
  justify-content: center; align-items: center;
  gap: 8px;
  margin: 20px auto 0;
  padding: 9px 14px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 99px;
  width: fit-content;
  position: relative;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 4px 18px rgba(0,0,0,0.22);
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.45s backwards;
}
.page-dots::before {
  content: '';
  position: absolute;
  top: 0; left: 25%; right: 25%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
  pointer-events: none;
}
.page-dots.hidden { display: none; }
.dot {
  width: 7px; height: 7px;
  border-radius: 99px;
  background: rgba(255,255,255,0.22);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
  border: none; padding: 0;
  flex-shrink: 0;
}
.dot.active {
  width: 24px;
  background: var(--accent-magenta);
  box-shadow: 0 0 14px rgba(251, 31, 246, 0.7);
}

/* ============================================================
   Footer
   ============================================================ */
.footer {
  text-align: center;
  margin-top: 36px;
  font-size: 11px;
  color: var(--text-tertiary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 500;
  animation: fadeUp 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.4s backwards;
}
.footer a {
  color: var(--text-secondary);
  text-decoration: none;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--glass-border);
}
.footer a:active { color: var(--accent-magenta); }

/* ============================================================
   Error / Empty
   ============================================================ */
.error-message {
  grid-column: 1 / -1;
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 110, 110, 0.22);
  border-radius: 22px;
  padding: 22px 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
  text-align: center;
  line-height: 1.5;
}
.error-message strong {
  color: var(--text-primary);
  font-weight: 500;
  display: block;
  margin-bottom: 6px;
}
.error-message code {
  background: rgba(255,255,255,0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent-magenta);
}

/* ============================================================
   Forms (Login + Admin)
   ============================================================ */
.form-section {
  margin-bottom: 24px;
  animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) backwards;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.field label {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  padding-left: 4px;
}

.input,
.select,
.textarea {
  width: 100%;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  outline: none;
  transition: border-color 0.25s ease, background 0.25s ease;
  -webkit-appearance: none;
  appearance: none;
}
.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--glass-border-bright);
  background: var(--glass-bg-pressed);
}
.input::placeholder { color: var(--text-tertiary); }

.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5L6 6.5L11 1.5' stroke='%23ffffff99' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.select option { background: #14081f; color: #fff; }

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
  cursor: pointer;
}
.toggle-label {
  font-size: 15px;
  color: var(--text-primary);
  user-select: none;
}
.toggle-switch {
  position: relative;
  width: 44px; height: 26px;
  background: rgba(255,255,255,0.12);
  border-radius: 99px;
  transition: background 0.25s ease;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.toggle input { display: none; }
.toggle input:checked ~ .toggle-switch {
  background: var(--accent-magenta);
  box-shadow: 0 0 14px rgba(251, 31, 246, 0.5);
}
.toggle input:checked ~ .toggle-switch::after { transform: translateX(18px); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  position: relative;
  width: 100%;
  padding: 16px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  color: var(--text-primary);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.07),
    0 4px 18px rgba(0,0,0,0.22);
}
.btn::before {
  content: '';
  position: absolute;
  top: 0; left: 15%; right: 15%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
}
.btn:active { transform: scale(0.97); background: var(--glass-bg-pressed); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, rgba(251,31,246,0.35), rgba(255,121,80,0.25));
  border-color: rgba(251, 31, 246, 0.4);
}
.btn-primary:active { background: linear-gradient(135deg, rgba(251,31,246,0.5), rgba(255,121,80,0.35)); }

.btn-danger { border-color: rgba(239, 68, 68, 0.3); color: #ffb1b1; }
.btn-ghost  { background: transparent; }

.btn-small {
  width: auto;
  padding: 10px 14px;
  font-size: 12px;
  border-radius: 14px;
}
.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  flex-shrink: 0;
}

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.btn-row .btn { flex: 1; }

/* ============================================================
   Toast / Status
   ============================================================ */
.toast {
  position: fixed;
  left: 50%; bottom: calc(var(--safe-bottom) + 24px);
  transform: translate(-50%, 30px);
  padding: 12px 18px;
  background: var(--glass-bg-strong);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-weight: 500;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    0 8px 30px rgba(0,0,0,0.3);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.success { border-color: rgba(16, 185, 129, 0.4); }
.toast.error   { border-color: rgba(239, 68, 68, 0.4); }

/* ============================================================
   Animationen
   ============================================================ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
.link-card:nth-child(1) { animation-delay: 0.22s; }
.link-card:nth-child(2) { animation-delay: 0.27s; }
.link-card:nth-child(3) { animation-delay: 0.32s; }
.link-card:nth-child(4) { animation-delay: 0.37s; }
.link-card:nth-child(5) { animation-delay: 0.42s; }
.link-card:nth-child(6) { animation-delay: 0.47s; }
.link-card:nth-child(n+7) { animation-delay: 0.5s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .ambient-orb { animation: none; }
}
