/* =============================================================
   THE LINKER – Globales Stylesheet
   Basiert auf CONTEXT/DESIGN.md (SPZL Dark-Violet System)
   ============================================================= */

/* --- Design Tokens ------------------------------------------- */
:root {
    /* Farben */
    --primary: #150f23;
    --ink-deep: #1f1633;
    --on-primary: #ffffff;
    --accent-blue: #00D2FC;
    --accent-love-red: #ff1744;
    --accent-violet: #6a5fc1;
    --accent-violet-deep: #422082;
    --accent-violet-mid: #79628c;
    --surface-canvas-dark: #1f1633;
    --surface-canvas-light: #ffffff;
    --surface-night: #150f23;
    --surface-press-light: #f0f0f0;
    --hairline-violet: #362d59;
    --hairline-cool: #cfcfdb;
    --hairline-cloud: #e5e7eb;
    --ink: #1f1633;
    --on-dark-muted: rgba(255, 255, 255, .72);
    --on-dark-faint: rgba(255, 255, 255, .18);
    --ring-focus: rgba(59, 130, 246, .5);

    /* Radius */
    --r-xs: 4px;  --r-sm: 6px;  --r-md: 8px;
    --r-lg: 10px; --r-xl: 12px; --r-xxl: 18px; --r-full: 9999px;

    /* Spacing (Basis 8px) */
    --s-xxs: 2px; --s-xs: 4px;  --s-sm: 8px;  --s-md: 12px;
    --s-lg: 16px; --s-xl: 24px; --s-xxl: 32px; --s-section: 96px;

    /* Typografie */
    --font-ui: "Rubik", -apple-system, system-ui, "Segoe UI", Helvetica, Arial, sans-serif;
    --font-display: "Space Grotesk", "Rubik", system-ui, sans-serif;
    --font-code: "Monaco", "Menlo", "Ubuntu Mono", monospace;
}

/* --- Reset --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.5;
    color: var(--on-primary);
    background: var(--surface-canvas-dark);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

img { max-width: 100%; display: block; }

/* --- Dark-Canvas-Atmosphäre (Starfield) --------------------- */
.canvas-dark {
    background-color: var(--surface-canvas-dark);
    background-image:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,.05) 0 1px, transparent 1px),
        radial-gradient(circle at 75% 12%, rgba(255,255,255,.04) 0 1px, transparent 1px),
        radial-gradient(circle at 50% 60%, rgba(255,255,255,.04) 0 1px, transparent 1px),
        radial-gradient(circle at 85% 80%, rgba(255,255,255,.05) 0 1px, transparent 1px),
        radial-gradient(circle at 25% 85%, rgba(255,255,255,.03) 0 1px, transparent 1px);
    background-size: 320px 320px, 360px 360px, 300px 300px, 420px 420px, 280px 280px;
}

/* --- Layout-Hüllen ------------------------------------------ */
.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--s-xl);
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface-night);
    border: 1px solid var(--hairline-violet);
    border-radius: var(--r-xl);
    padding: var(--s-xxl);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--s-md);
    margin-bottom: var(--s-xl);
}
.brand img { width: 40px; height: 40px; border-radius: var(--r-md); }
.brand-name {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    letter-spacing: .2px;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: var(--s-xs);
}
.auth-sub {
    color: var(--on-dark-muted);
    font-size: 15px;
    margin-bottom: var(--s-xl);
}

/* --- Formulare ---------------------------------------------- */
.field { margin-bottom: var(--s-lg); }

.label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: var(--s-xs);
    color: var(--on-dark-muted);
}

.input {
    width: 100%;
    font-family: var(--font-ui);
    font-size: 16px;
    color: var(--on-primary);
    background: rgba(255, 255, 255, .04);
    border: 1px solid var(--hairline-violet);
    border-radius: var(--r-sm);
    padding: 12px 14px;
    transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: rgba(255, 255, 255, .35); }
.input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--ring-focus);
}
.input.has-error { border-color: var(--accent-love-red); }

.field-error {
    display: block;
    color: var(--accent-love-red);
    font-size: 13px;
    margin-top: var(--s-xs);
}

.checkrow {
    display: flex;
    align-items: center;
    gap: var(--s-sm);
    margin-bottom: var(--s-lg);
    font-size: 14px;
    color: var(--on-dark-muted);
}
.checkrow input { accent-color: var(--accent-blue); width: 16px; height: 16px; }

/* --- Buttons ------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--s-sm);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .2px;
    text-transform: uppercase;
    text-decoration: none;
    border: none;
    border-radius: var(--r-md);
    padding: 13px 16px;
    cursor: pointer;
    transition: transform .05s, background-color .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }

/* Auf dunklem Canvas ist die invertierte (weiße) Variante der primäre CTA */
.btn-primary {
    background: var(--on-primary);
    color: var(--ink-deep);
    width: 100%;
}
.btn-primary:hover { background: var(--surface-press-light); }

.btn-ghost {
    background: var(--on-dark-faint);
    color: var(--on-primary);
    border-radius: var(--r-xl);
}
.btn-ghost:hover { background: rgba(255, 255, 255, .26); }

.btn-block { width: 100%; }

/* --- Hilfslinks / Footer der Card --------------------------- */
.auth-foot {
    margin-top: var(--s-xl);
    padding-top: var(--s-lg);
    border-top: 1px solid var(--hairline-violet);
    text-align: center;
    font-size: 14px;
    color: var(--on-dark-muted);
}
.auth-foot a { color: var(--accent-blue); text-decoration: none; font-weight: 500; }
.auth-foot a:hover { text-decoration: underline; }

/* --- Flash-Meldungen ---------------------------------------- */
.flash {
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 14px;
    margin-bottom: var(--s-lg);
    border: 1px solid transparent;
}
.flash-success {
    background: rgba(0, 210, 252, .12);
    border-color: rgba(0, 210, 252, .4);
    color: #aef0ff;
}
.flash-error {
    background: rgba(255, 23, 68, .12);
    border-color: rgba(255, 23, 68, .4);
    color: #ffb3c4;
}

/* --- App-Topbar (eingeloggt) -------------------------------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--s-lg) var(--s-xl);
    border-bottom: 1px solid var(--hairline-violet);
    background: var(--surface-night);
}
.topbar .brand { margin-bottom: 0; }

.container {
    max-width: 1152px;
    margin: 0 auto;
    padding: var(--s-xl);
}

.card {
    background: var(--surface-night);
    border: 1px solid var(--hairline-violet);
    border-radius: var(--r-xl);
    padding: var(--s-xxl);
}

.eyebrow {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .25px;
    text-transform: uppercase;
    color: var(--accent-blue);
}

.display-h {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.15;
}

.muted { color: var(--on-dark-muted); }

/* --- Dashboard / Formularseiten ----------------------------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--s-lg);
}

textarea.input { resize: vertical; min-height: 96px; font-family: var(--font-ui); }

.input.file {
    padding: 10px 12px;
    background: rgba(255, 255, 255, .04);
    cursor: pointer;
}
.input.file::file-selector-button {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink-deep);
    background: var(--on-primary);
    border: none;
    border-radius: var(--r-sm);
    padding: 7px 12px;
    margin-right: 12px;
    cursor: pointer;
}

.hint { display: block; color: var(--on-dark-muted); font-size: 13px; margin-top: 2px; }

.divider { height: 1px; background: var(--hairline-violet); margin: var(--s-xl) 0; }

/* Zweispaltige Formularzeile: Label links, Feld rechts */
.form-row { display: grid; grid-template-columns: 220px 1fr; gap: var(--s-xl); align-items: start; }
.form-label-col .label { margin-bottom: 2px; }
.form-field-col { min-width: 0; }

.media-row { display: flex; align-items: center; gap: var(--s-lg); margin-bottom: var(--s-sm); }

.avatar-preview {
    width: 72px; height: 72px; flex: 0 0 72px;
    border-radius: var(--r-full);
    overflow: hidden;
    background: var(--accent-violet-deep);
    display: grid; place-items: center;
    font-family: var(--font-display); font-weight: 700; font-size: 28px;
    color: var(--on-primary);
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }

.bg-preview {
    width: 100%; height: 120px;
    border-radius: var(--r-md);
    background-size: cover; background-position: center;
    border: 1px solid var(--hairline-violet);
    margin-bottom: var(--s-sm);
}

.link-danger {
    display: inline-block;
    background: none; border: none; padding: 0; margin-top: var(--s-xs);
    color: var(--accent-love-red);
    font-size: 13px; font-weight: 500; cursor: pointer;
}
.link-danger:hover { text-decoration: underline; }

.form-actions {
    margin-top: var(--s-xl);
    padding-top: var(--s-lg);
    border-top: 1px solid var(--hairline-violet);
}

/* Dashboard-Navigation (Tabs/Links) */
.dash-nav { display: flex; flex-wrap: wrap; gap: var(--s-sm); margin: var(--s-lg) 0 var(--s-xl); }
.dash-nav a {
    text-decoration: none;
    font-size: 14px; font-weight: 500;
    color: var(--on-dark-muted);
    background: var(--on-dark-faint);
    padding: 8px 16px; border-radius: var(--r-xl);
    transition: background-color .15s, color .15s;
}
.dash-nav a:hover { background: rgba(255,255,255,.26); color: var(--on-primary); }
.dash-nav a.active { background: var(--on-primary); color: var(--ink-deep); }

/* --- Responsive --------------------------------------------- */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; gap: var(--s-sm); }
    .form-label-col { margin-bottom: var(--s-xs); }
}

@media (max-width: 575px) {
    .auth-card { padding: var(--s-xl); }
    .auth-title { font-size: 26px; }
    .container { padding: var(--s-lg); }
    .page-head { flex-direction: column; align-items: flex-start; gap: var(--s-md); }
}

/* --- Linkverwaltung ----------------------------------------- */
.add-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-sm);
    margin: var(--s-lg) 0 var(--s-xl);
}
.add-label { font-size: 14px; color: var(--on-dark-muted); margin-right: var(--s-xs); }
.chip-add {
    text-decoration: none; font-size: 14px; font-weight: 600;
    color: var(--ink-deep); background: var(--on-primary);
    padding: 8px 14px; border-radius: var(--r-xl);
    transition: transform .05s, background-color .15s;
}
.chip-add:hover { background: var(--surface-press-light); }
.chip-add:active { transform: translateY(1px); }

.item-list { list-style: none; display: flex; flex-direction: column; gap: var(--s-sm); }

.item-row {
    display: flex; align-items: center; gap: var(--s-md);
    background: var(--surface-night);
    border: 1px solid var(--hairline-violet);
    border-radius: var(--r-lg);
    padding: var(--s-md) var(--s-lg);
}
.item-row.is-inactive { opacity: .5; }
.item-row.dragging { opacity: .4; outline: 2px dashed var(--accent-blue); }
.item-row.drop-target { border-color: var(--accent-blue); }

.drag-handle {
    cursor: grab; color: var(--on-dark-muted); font-size: 18px;
    line-height: 1; user-select: none; flex: 0 0 auto;
}
.drag-handle:active { cursor: grabbing; }

.type-badge {
    flex: 0 0 auto; font-size: 10px; font-weight: 600; letter-spacing: .25px;
    text-transform: uppercase; padding: 4px 8px; border-radius: var(--r-xs);
    background: var(--accent-violet-mid); color: var(--on-primary);
}
.type-badge.type-link    { background: var(--accent-violet-deep); }
.type-badge.type-heading { background: #2f6f5b; }
.type-badge.type-text    { background: #3a4a6b; }
.type-badge.type-divider { background: #4a4458; }
.type-badge.type-notice  { background: #6b4a2f; }

.item-main { flex: 1 1 auto; min-width: 0; }
.item-title {
    display: block; font-size: 15px; font-weight: 500; color: var(--on-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.item-title .star { color: var(--accent-blue); }
.item-sub {
    display: block; font-size: 12px; color: var(--on-dark-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.item-actions { display: flex; align-items: center; gap: var(--s-xs); flex: 0 0 auto; }
.inline { display: inline; margin: 0; }

.icon-btn {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px;
    background: var(--on-dark-faint); color: var(--on-primary);
    border: none; border-radius: var(--r-md);
    font-size: 15px; text-decoration: none; cursor: pointer;
    transition: background-color .15s;
}
.icon-btn:hover { background: rgba(255,255,255,.26); }
.icon-btn.on { color: var(--accent-blue); }
.icon-btn.danger:hover { background: rgba(255,23,68,.25); }

/* Aktiv/Inaktiv-Schalter */
.toggle-pill {
    width: 44px; height: 26px; border-radius: var(--r-full);
    background: var(--on-dark-faint); border: none; cursor: pointer;
    position: relative; padding: 0; transition: background-color .15s;
}
.toggle-pill .dot {
    position: absolute; top: 3px; left: 3px;
    width: 20px; height: 20px; border-radius: var(--r-full);
    background: #fff; transition: transform .15s;
}
.toggle-pill.on { background: var(--accent-blue); }
.toggle-pill.on .dot { transform: translateX(18px); }

@media (max-width: 575px) {
    .item-sub { display: none; }
    .type-badge { display: none; }
}

/* --- Toast (JS-Feedback) ------------------------------------ */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 16px);
    background: var(--surface-night); color: var(--on-primary);
    border: 1px solid var(--accent-blue);
    padding: 10px 18px; border-radius: var(--r-full);
    font-size: 14px; font-weight: 500;
    opacity: 0; transition: opacity .2s, transform .2s; z-index: 9999;
    box-shadow: rgba(0,0,0,.3) 0 8px 24px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { border-color: var(--accent-love-red); }

/* =============================================================
   Öffentliche Linkseite (.pp) – nutzt scoped --ud-* Variablen
   ============================================================= */
.pp {
    min-height: 100vh;
    background: var(--ud-bg, #150f23);
    color: var(--ud-text, #fff);
    padding: 56px 20px 40px;
    position: relative;
    overflow-x: hidden;
}
.pp.pp-has-bgimg::before {
    content: ''; position: fixed; inset: 0; z-index: 0;
    background-image: var(--ud-bgimg);
    background-size: cover; background-position: center;
}
.pp.pp-has-bgimg::after {
    content: ''; position: fixed; inset: 0; z-index: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.35), rgba(0,0,0,.6));
}
.pp-inner {
    position: relative; z-index: 1;
    width: 100%; max-width: 560px; margin: 0 auto;
}

/* Share */
.pp-share {
    position: absolute; top: 16px; right: 16px; z-index: 2;
    width: 42px; height: 42px; display: grid; place-items: center;
    border: none; border-radius: var(--r-full); cursor: pointer;
    background: rgba(255,255,255,.14); color: var(--ud-text, #fff);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    transition: background-color .15s, transform .05s;
}
.pp-share:hover { background: rgba(255,255,255,.26); }
.pp-share:active { transform: scale(.94); }
.pp-share svg { width: 20px; height: 20px; }

/* Kopf */
.pp-head { text-align: center; margin-bottom: 24px; }
.pp-avatar {
    width: 96px; height: 96px; margin: 0 auto 14px;
    border-radius: var(--r-full); overflow: hidden;
    background: var(--ud-accent, #00D2FC);
    display: grid; place-items: center;
    font-size: 38px; font-weight: 700; color: #fff;
    box-shadow: 0 6px 24px rgba(0,0,0,.3);
}
.pp-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pp-name { font-size: 24px; font-weight: 700; line-height: 1.2; }
.pp-handle { font-size: 14px; opacity: .7; margin-top: 2px; }
.pp-bio { font-size: 15px; line-height: 1.5; opacity: .9; margin-top: 12px; max-width: 440px; margin-left: auto; margin-right: auto; }

/* Social-Leiste */
.pp-socials { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin: 18px 0 28px; }
.pp-social {
    width: 26px; height: 26px; color: var(--ud-text, #fff); opacity: .85;
    transition: opacity .15s, transform .1s;
}
.pp-social:hover { opacity: 1; transform: translateY(-2px); }
.pp-social svg { width: 100%; height: 100%; }

/* Items */
.pp-items { display: flex; flex-direction: column; gap: 14px; }
.pp-empty { text-align: center; opacity: .6; padding: 24px 0; }

/* Link-Buttons – Basis */
.pp-link {
    display: flex; align-items: center; gap: 14px;
    text-decoration: none; color: var(--ud-btn-text, #1f1633);
    border-radius: var(--ud-radius, 8px);
    padding: 16px 18px; min-height: 56px;
    transition: transform .08s, box-shadow .15s, background-color .15s;
}
.pp-link:active { transform: scale(.99); }
.pp-link-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 8px; overflow: hidden; }
.pp-link-icon img { width: 100%; height: 100%; object-fit: cover; }
.pp-link-body { flex: 1 1 auto; min-width: 0; text-align: center; }
.pp-link-title { display: block; font-weight: 600; font-size: 16px; }
.pp-link-desc { display: block; font-size: 13px; opacity: .75; margin-top: 2px; }

/* Button-Stil: fill (Fallback volle Farbe, dann color-mix mit Opazität) */
.pp-btn-fill .pp-link {
    background: var(--ud-btn, #fff);
    background: color-mix(in srgb, var(--ud-btn, #fff) calc(var(--ud-btn-op, 1) * 100%), transparent);
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
}
/* outline */
.pp-btn-outline .pp-link {
    background: transparent;
    border: 2px solid var(--ud-btn, #fff);
    color: var(--ud-text, #fff);
}
/* soft */
.pp-btn-soft .pp-link {
    background: color-mix(in srgb, var(--ud-btn, #fff) 18%, transparent);
    color: var(--ud-text, #fff);
}
/* glass */
.pp-btn-glass .pp-link {
    background: rgba(255,255,255,.12);
    -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,.18);
    color: var(--ud-text, #fff);
}

/* Highlight */
.pp-link.is-highlight {
    box-shadow: 0 0 0 2px var(--ud-accent, #00D2FC), 0 6px 22px color-mix(in srgb, var(--ud-accent, #00D2FC) 40%, transparent);
}

/* Blöcke */
.pp-heading { text-align: center; font-size: 18px; font-weight: 700; margin: 14px 0 2px; }
.pp-text { text-align: center; font-size: 15px; line-height: 1.55; opacity: .9; }
.pp-divider { border: none; height: 1px; background: currentColor; opacity: .2; margin: 8px 0; }
.pp-notice {
    border-radius: var(--r-md); padding: 12px 14px; font-size: 14px; line-height: 1.5;
    border: 1px solid transparent;
}
.pp-notice-info    { background: rgba(0,210,252,.12);  border-color: rgba(0,210,252,.45);  }
.pp-notice-success { background: rgba(52,211,153,.14); border-color: rgba(52,211,153,.5);  }
.pp-notice-warning { background: rgba(251,191,36,.14); border-color: rgba(251,191,36,.5);  }
.pp-notice-danger  { background: rgba(255,23,68,.14);  border-color: rgba(255,23,68,.5);   }

/* Footer */
.pp-foot { text-align: center; margin-top: 36px; }
.pp-brand {
    display: inline-flex; align-items: center; gap: 8px;
    text-decoration: none; color: var(--ud-text, #fff); opacity: .6;
    font-size: 13px; font-weight: 600;
}
.pp-brand img { width: 20px; height: 20px; border-radius: 5px; }
.pp-brand:hover { opacity: .9; }

@media (max-width: 480px) {
    .pp { padding-top: 48px; }
    .pp-avatar { width: 84px; height: 84px; font-size: 32px; }
    .pp-name { font-size: 21px; }
}

/* --- Social-Verwaltung -------------------------------------- */
.social-add-row { display: flex; gap: var(--s-md); align-items: flex-end; flex-wrap: wrap; }
.social-add-row .field { min-width: 160px; }
.social-add-btn { width: auto; padding: 13px 22px; white-space: nowrap; }
.social-glyph { width: 28px; height: 28px; flex: 0 0 auto; color: var(--on-primary); opacity: .9; }
.social-glyph svg { width: 100%; height: 100%; }
@media (max-width: 575px) {
    .social-add-row { flex-direction: column; align-items: stretch; }
    .social-add-row .field { min-width: 0; }
    .social-add-btn { width: 100%; }
}

/* --- Dashboard-Grid + Live-Vorschau (Handy-Mockup) ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-xl); align-items: start; }
.dash-main { min-width: 0; }
.dash-aside { display: flex; flex-direction: column; gap: var(--s-md); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-sm); }
.preview-hint { font-size: 12px; text-align: center; margin: 0; }

.preview-phone {
    --pw: 390px; --ph: 780px; --pscale: .70;
    width: fit-content; margin: 0 auto; padding: 12px; position: relative;
    background: #0d0a18; border: 1px solid var(--hairline-violet);
    border-radius: 34px; box-shadow: rgba(0, 0, 0, .45) 0 14px 34px;
}
.preview-phone::before {
    content: ''; position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
    width: 36%; height: 7px; z-index: 2;
    background: #0d0a18; border: 1px solid var(--hairline-violet); border-radius: var(--r-full);
}
.preview-phone-screen {
    position: relative; overflow: hidden; border-radius: 24px; background: var(--surface-night);
    width: calc(var(--pw) * var(--pscale));
    height: calc(var(--ph) * var(--pscale));
}
.preview-phone-screen iframe {
    width: var(--pw); height: var(--ph); border: 0; display: block;
    transform: scale(var(--pscale)); transform-origin: top left;
}
.icon-btn.is-spinning svg { animation: spin .6s linear; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 880px) {
    .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
    .preview-phone { --pscale: .58; }
}

/* --- Design-Verwaltung -------------------------------------- */
.design-layout { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--s-xl); align-items: start; margin-top: var(--s-xl); }
.design-form .section-title { font-size: 18px; margin-bottom: var(--s-md); }
.color-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s-md); margin-bottom: var(--s-md); }
.color-field { display: flex; align-items: center; gap: var(--s-sm); cursor: pointer; }
.color-field input[type="color"] {
    inline-size: 44px; block-size: 44px; padding: 0; flex: 0 0 auto;
    border: 1px solid var(--hairline-violet); border-radius: var(--r-md);
    background: none; cursor: pointer;
}
.color-field input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
.color-field input[type="color"]::-webkit-color-swatch { border: none; border-radius: var(--r-sm); }
.color-field input[type="color"]::-moz-color-swatch { border: none; border-radius: var(--r-sm); }
.color-field .label { font-size: 14px; }

.range-field { margin: var(--s-md) 0; }
.range-field .label { display: block; margin-bottom: var(--s-xs); }
.range-field output { color: var(--accent-blue); font-weight: 600; font-variant-numeric: tabular-nums; }
.range-field input[type="range"] { width: 100%; accent-color: var(--accent-blue); }

.design-preview { position: sticky; top: var(--s-lg); display: flex; flex-direction: column; gap: var(--s-md); }

@media (max-width: 880px) {
    .design-layout { grid-template-columns: 1fr; }
    .design-preview { position: static; }
}

/* --- Action-Buttons (Content-Bloecke type=button) ----------- */
.type-badge.type-button { background: #2f5d6b; }
.pp-action-icon { display: flex; align-items: center; justify-content: center; background: transparent; }
.pp-action-icon svg { width: 22px; height: 22px; }

/* --- Embeds (Content-Bloecke type=embed) -------------------- */
.type-badge.type-embed { background: #5a3a6b; }
.pp-embed-title { font-weight: 600; font-size: 14px; margin: 8px 0 2px; opacity: .85; }
.pp-embed { position: relative; width: 100%; margin: 8px 0; border-radius: 12px; overflow: hidden; background: rgba(0, 0, 0, .2); }
.pp-embed iframe { width: 100%; border: 0; display: block; }
.pp-embed-youtube, .pp-embed-maps { aspect-ratio: 16 / 9; }
.pp-embed-youtube iframe, .pp-embed-maps iframe { position: absolute; inset: 0; width: 100%; height: 100%; }
.pp-embed-spotify iframe { height: 152px; }
.pp-embed-spotify.is-tall iframe { height: 352px; }
.pp-embed-soundcloud iframe { height: 166px; }
.pp-embed-discord { max-width: 350px; margin-inline: auto; }
.pp-embed-discord iframe { height: 500px; }

/* --- Medienbloecke (type=image|video) ----------------------- */
.type-badge.type-image { background: #3a5a3a; }
.type-badge.type-video { background: #6b3a3a; }
.pp-media { margin: 8px 0; }
.pp-media img, .pp-media video { width: 100%; border-radius: 12px; display: block; }
.pp-media-cap { font-size: 13px; opacity: .75; margin-top: 4px; text-align: center; }

/* --- Bildergalerie (type=gallery) -------------------------------- */
.type-badge.type-gallery { background: #2a4a6b; }

/* Dashboard: Thumbnail-Grid zum Verwalten bestehender Bilder */
.gallery-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-top: 8px;
}
.gallery-thumb {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: var(--on-dark-faint);
}
.gallery-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.gallery-thumb-del {
    position: absolute; top: 4px; right: 4px;
    width: 22px; height: 22px;
    background: rgba(0,0,0,.65);
    color: #fff;
    border: none; border-radius: 50%;
    font-size: 14px; line-height: 22px; text-align: center;
    cursor: pointer;
    padding: 0;
    display: flex; align-items: center; justify-content: center;
}
.gallery-thumb-del:hover { background: var(--accent-love-red); }

/* Öffentliche Seite: .pp-gallery */
.pp-gallery { margin: 8px 0; }
.pp-gallery-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    opacity: .85;
    display: block;
}
.pp-gallery-grid {
    display: grid;
    gap: 6px;
    border-radius: 14px;
    overflow: hidden;
}
.pp-gallery-1col { grid-template-columns: 1fr; }
.pp-gallery-2col { grid-template-columns: 1fr 1fr; }
.pp-gallery-3col { grid-template-columns: 1fr 1fr 1fr; }
.pp-gallery-cell { aspect-ratio: 1 / 1; overflow: hidden; }
.pp-gallery-cell img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .2s;
}
.pp-gallery-cell img:hover { transform: scale(1.04); }

/* =====================================================================
   Countdown-Block (type=countdown) – Phase 1.3c
   ===================================================================== */

.type-badge.type-countdown { background: #4a2a6b; }

/* --- Oeffentliche Seite -------------------------------------------- */
.pp-countdown {
    background: rgba(0,0,0,.22);
    border-radius: 14px;
    padding: 22px 16px 18px;
    margin: 8px 0;
    text-align: center;
}

.pp-countdown-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    opacity: .85;
    margin-bottom: 14px;
    letter-spacing: .01em;
}

.pp-countdown-digits {
    display: flex;
    gap: 4px;
    justify-content: center;
    align-items: flex-end;
}

.pp-cd-seg {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 52px;
}

.pp-cd-num {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    color: var(--ud-accent, #00D2FC);
}

.pp-cd-lbl {
    font-size: 10px;
    opacity: .6;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 5px;
}

.pp-cd-sep {
    font-size: 2rem;
    font-weight: 700;
    opacity: .35;
    padding-bottom: 16px;
    user-select: none;
}

.pp-countdown-exp {
    margin: 12px 0 0;
    font-size: 14px;
    opacity: .7;
    padding: 4px 0;
}

/* =====================================================================
   Badge-Labels an page_items – Phase 1.3d
   ===================================================================== */

.pp-badge-wrap {
    position: relative;
    display: block;
}

.pp-badge {
    position: absolute;
    top: -9px;
    right: 12px;
    background: var(--badge-bg, #7c3aed);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 2;
    box-shadow: 0 1px 6px rgba(0,0,0,.4);
}

/* =====================================================================
   Audioplayer-Block (type=audio) – Phase 1.3e
   ===================================================================== */

.type-badge.type-audio { background: #2a6b4a; }

.pp-audio {
    background: rgba(0,0,0,.2);
    border-radius: 14px;
    padding: 16px;
    margin: 8px 0;
}

.pp-audio-title {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 10px;
    opacity: .9;
}

.pp-audio-player {
    width: 100%;
    border-radius: 8px;
    display: block;
    accent-color: var(--ud-accent, #00D2FC);
}

.pp-audio-desc {
    font-size: 13px;
    opacity: .65;
    margin: 8px 0 0;
}

/* =====================================================================
   Phase 6 — Verifizierung + Adminpanel
   ===================================================================== */

/* --- Verified Badge (Public Profile) ---------------------------------- */
.pp-name {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

.pp-verified {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}

.pp-verified svg {
    width: 22px;
    height: 22px;
    vertical-align: middle;
}

/* --- Admin-Bar auf Public Profile ------------------------------------- */
.pp-admin-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(21,15,35,.96);
    backdrop-filter: blur(8px);
    border-top: 1px solid #362d59;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pp-admin-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .8px;
    text-transform: uppercase;
    color: #00D2FC;
    margin-right: 4px;
}

/* --- Admin Panel (allgemein) ----------------------------------------- */
.admin-table-wrap {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th {
    background: var(--surface2);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: var(--muted);
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.admin-table tr:last-child td { border-bottom: none; }

.admin-table tr.row-banned td { opacity: .6; }
.admin-table tr.row-inactive td { opacity: .55; }

.admin-table tr:hover td { background: rgba(255,255,255,.025); }

.admin-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

/* Small buttons for admin table */
.btn-xs {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
}

.btn-warn {
    background: #92400e;
    color: #fef3c7;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.btn-warn:hover { background: #b45309; }

.btn-danger {
    background: #7f1d1d;
    color: #fee2e2;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.btn-danger:hover { background: #991b1b; }

.btn-accent {
    background: #00D2FC22;
    color: #00D2FC;
    border: 1px solid #00D2FC55;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.btn-accent:hover { background: #00D2FC33; }

/* Status pills */
.status-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
}
.status-pill.status-active  { background: #14532d; color: #bbf7d0; }
.status-pill.status-banned  { background: #7f1d1d; color: #fecaca; }

/* Flag chips */
.flag-chip {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-right: 3px;
}
.flag-chip.flag-verified { background: #00D2FC22; color: #00D2FC; }
.flag-chip.flag-admin    { background: #6a5fc122; color: #a89be0; }

/* Verified badge in table */
.badge-verified {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #00D2FC;
    color: #150f23;
    border-radius: 50%;
    font-size: 10px;
    font-weight: 900;
    margin-left: 4px;
    vertical-align: middle;
    line-height: 1;
}

.admin-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    background: #6a5fc1;
    color: #fff;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 900;
    margin-left: 2px;
    vertical-align: middle;
}

/* Toggle dot (links table) */
.toggle-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
}
.toggle-dot.is-on  { background: #22c55e; }
.toggle-dot.is-off { background: #4b5563; }

/* Pagination */
.admin-pager {
    display: flex;
    gap: 6px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.pager-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 6px;
    background: var(--surface2);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--border);
}

.pager-btn.is-active {
    background: var(--accent);
    color: #150f23;
    border-color: var(--accent);
    font-weight: 700;
}

/* Admin tab in dashboard nav */
.dash-nav a.nav-admin {
    color: #00D2FC;
}

/* =============================================================
   Phase 4 — Umfragen (Polls) + Gewinnspiele (Giveaways)
   Öffentliche Seite + Dashboard-Styles
   ============================================================= */

/* --- Öffentliche Umfrage ------------------------------------ */
.pp-poll {
    background: color-mix(in srgb, var(--ud-btn) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--ud-btn) 30%, transparent);
    border-radius: calc(var(--ud-radius) * 1px);
    padding: 20px;
    margin: 8px 0;
}
.pp-poll-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--ud-text);
    margin-bottom: 4px;
}
.pp-poll-desc {
    font-size: 13px;
    color: var(--ud-text);
    opacity: .75;
    margin-bottom: 10px;
}
.pp-poll-msg  { font-size: 13px; margin-bottom: 8px; border-radius: 6px; padding: 6px 10px; }
.pp-poll-err  { background: rgba(255,23,68,.15); color: #ff5a70; }

/* Abstimmungsformular */
.pp-poll-form { display: flex; flex-direction: column; gap: 8px; }
.pp-poll-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: calc(var(--ud-radius) * 1px);
    border: 1px solid color-mix(in srgb, var(--ud-text) 20%, transparent);
    cursor: pointer;
    color: var(--ud-text);
    font-size: 14px;
    transition: background .15s;
}
.pp-poll-option:hover { background: color-mix(in srgb, var(--ud-btn) 15%, transparent); }
.pp-poll-option input { accent-color: var(--ud-accent); width: 16px; height: 16px; flex-shrink: 0; }
.pp-poll-btn { margin-top: 4px; justify-content: center; text-align: center; }

/* Ergebnisbalken */
.pp-poll-results { display: flex; flex-direction: column; gap: 10px; }
.pp-poll-bar-wrap {}
.pp-poll-bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--ud-text);
    margin-bottom: 4px;
}
.pp-poll-bar-track {
    height: 8px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--ud-text) 15%, transparent);
    overflow: hidden;
}
.pp-poll-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--ud-accent);
    transition: width .4s ease;
    min-width: 2px;
}
.pp-poll-total { font-size: 12px; opacity: .6; color: var(--ud-text); margin-top: 6px; }

/* --- Öffentliches Gewinnspiel -------------------------------- */
.pp-giveaway {
    background: color-mix(in srgb, var(--ud-accent) 8%, transparent);
    border: 1px solid color-mix(in srgb, var(--ud-accent) 35%, transparent);
    border-radius: calc(var(--ud-radius) * 1px);
    padding: 20px;
    margin: 8px 0;
}
.pp-giveaway-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
    color: var(--ud-accent);
    margin-bottom: 6px;
}
.pp-giveaway-form { display: flex; flex-direction: column; gap: 8px; }
.pp-giveaway-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: calc(var(--ud-radius) * 1px);
    border: 1px solid color-mix(in srgb, var(--ud-text) 25%, transparent);
    background: color-mix(in srgb, var(--ud-bg) 80%, transparent);
    color: var(--ud-text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
}
.pp-giveaway-input::placeholder { opacity: .5; }
.pp-giveaway-input:focus { border-color: var(--ud-accent); }
