/* ============================================================
   SHOWCASE ADMIN — dark glass UI, same brand language as the
   public pages but tuned for long editing sessions.
   ============================================================ */
:root {
    --bg: #070910;
    --panel: #0d101a;
    --panel-2: #11151f;
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.18);
    --text: #eef2fa;
    --text-2: #99a2b8;
    --text-3: #5b6479;
    --accent: #31a6b7;
    --accent-bright: #4cc2d3;
    --accent-soft: rgba(49, 166, 183, 0.12);
    --accent-border: rgba(49, 166, 183, 0.38);
    --danger: #f0616d;
    --danger-soft: rgba(240, 97, 109, 0.12);
    --warn: #f5c451;
    --ok: #46c68a;
    --radius: 14px;
    --font: 'Outfit', system-ui, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
}

a { color: var(--accent-bright); }

/* ============================================================
   SHELL
   ============================================================ */
.shell { display: flex; min-height: 100dvh; }

.sidebar {
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100dvh;
    flex: 0 0 246px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
    background: var(--panel);
    border-right: 1px solid var(--line);
}

.brand {
    display: flex; align-items: center; gap: 0.75rem;
    text-decoration: none; color: var(--text);
    padding: 0 0.5rem;
}
.brand img { height: 38px; width: auto; mix-blend-mode: screen; filter: brightness(1.35); }
.brand span { font-size: 0.82rem; line-height: 1.2; color: var(--text-2); letter-spacing: 0.02em; }
.brand strong { color: var(--text); font-weight: 700; letter-spacing: -0.01em; font-size: 0.95rem; }

.nav { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }

.nav-item {
    display: flex; align-items: center; gap: 0.7rem;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-2);
    font-size: 0.9rem;
    font-weight: 500;
    transition: background .18s ease, color .18s ease;
}
.nav-item i { width: 18px; text-align: center; font-size: 0.9rem; }
.nav-item:hover { background: rgba(255,255,255,0.05); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-bright); }
.nav-item.subtle { font-size: 0.84rem; }

.sidebar-foot { display: flex; flex-direction: column; gap: 0.35rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.who { display: flex; align-items: center; gap: 0.6rem; padding: 0 0.75rem; font-size: 0.82rem; color: var(--text-3); }

.content {
    flex: 1;
    min-width: 0;
    padding: 2rem 2.25rem 4rem;
    max-width: 1500px;
}

/* ============================================================
   HEADINGS / PAGE HEADER
   ============================================================ */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
}
.page-head h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.025em; }
.page-head .sub { color: var(--text-2); font-size: 0.88rem; margin-top: 0.25rem; }
.head-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

h2.section { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 0.15rem; }
.section-hint { font-size: 0.8rem; color: var(--text-3); margin-bottom: 1.1rem; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.55rem 1.05rem;
    border-radius: 100px;
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
.btn:hover { background: rgba(255,255,255,0.1); }
.btn i { font-size: 0.85rem; }

.btn.primary { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent-bright); }
.btn.primary:hover { background: rgba(49,166,183,0.24); border-color: rgba(49,166,183,0.6); }

.btn.solid { background: var(--accent); border-color: var(--accent); color: #04181c; }
.btn.solid:hover { background: var(--accent-bright); border-color: var(--accent-bright); }

.btn.danger { color: var(--danger); border-color: rgba(240,97,109,0.35); background: var(--danger-soft); }
.btn.danger:hover { background: rgba(240,97,109,0.22); }

.btn.small { padding: 0.35rem 0.8rem; font-size: 0.78rem; }
.btn.icon { padding: 0.45rem 0.6rem; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ============================================================
   PANELS / CARDS
   ============================================================ */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.35rem 1.4rem;
}
.panel + .panel { margin-top: 1.25rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 1.25rem; }

/* ============================================================
   FORMS
   ============================================================ */
.field { margin-bottom: 1rem; }
.field:last-child { margin-bottom: 0; }

label.lbl {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-3);
    margin-bottom: 0.4rem;
}

input[type=text], input[type=url], input[type=password], input[type=email], textarea, select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color .2s ease, background .2s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent-border);
    background: #141926;
}
textarea { resize: vertical; min-height: 88px; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #414a5e; }

input[type=color] {
    width: 54px; height: 38px; padding: 2px;
    border-radius: 10px; border: 1px solid var(--line);
    background: var(--panel-2); cursor: pointer;
}

input[type=file] {
    width: 100%;
    font-size: 0.82rem;
    color: var(--text-2);
    font-family: var(--font);
}
input[type=file]::file-selector-button {
    margin-right: 0.75rem;
    padding: 0.45rem 0.9rem;
    border-radius: 100px;
    border: 1px solid var(--line-strong);
    background: rgba(255,255,255,0.05);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: rgba(255,255,255,0.1); }

.hint { font-size: 0.76rem; color: var(--text-3); margin-top: 0.35rem; line-height: 1.45; }

.row { display: flex; gap: 0.75rem; align-items: flex-end; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; margin-bottom: 0; }

.check {
    display: flex; align-items: flex-start; gap: 0.6rem;
    font-size: 0.86rem; color: var(--text-2); cursor: pointer;
    padding: 0.5rem 0;
}
.check input { margin-top: 0.15rem; width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.check strong { color: var(--text); font-weight: 600; display: block; font-size: 0.88rem; }
.check .hint { margin-top: 0.1rem; }

/* Link-card vs video-card picker */
.type-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.75rem; }

.type-option {
    display: flex; align-items: flex-start; gap: 0.8rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel-2);
    cursor: pointer;
    transition: border-color .18s ease, background .18s ease;
}
.type-option:hover { border-color: var(--line-strong); }
.type-option.selected { border-color: var(--accent-border); background: var(--accent-soft); }
.type-option input { margin-top: 0.2rem; accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }
.type-option > i { font-size: 1rem; color: var(--text-3); margin-top: 0.15rem; }
.type-option.selected > i { color: var(--accent-bright); }
.type-option strong { display: block; font-size: 0.9rem; font-weight: 600; }
.type-option .hint { margin-top: 0.15rem; }

/* Card-kind badge in listings */
.kind-badge {
    display: inline-flex; align-items: center; gap: 0.3rem;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    padding: 0.2rem 0.5rem; border-radius: 100px;
}
.kind-badge.video { color: #d9c4ff; background: rgba(150, 110, 235, 0.18); }
.kind-badge.link  { color: #9fe4ef; background: rgba(49, 166, 183, 0.16); }

/* URL/handle input with a fixed prefix */
.prefixed {
    display: flex; align-items: stretch;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel-2);
    overflow: hidden;
}
.prefixed:focus-within { border-color: var(--accent-border); }
.prefixed .prefix {
    display: flex; align-items: center;
    padding: 0 0.7rem;
    font-size: 0.82rem;
    color: var(--text-3);
    background: rgba(255,255,255,0.03);
    border-right: 1px solid var(--line);
    white-space: nowrap;
}
.prefixed input { border: none; border-radius: 0; background: transparent; }
.prefixed input:focus { background: transparent; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    display: flex; gap: 0.75rem; align-items: flex-start;
    padding: 0.8rem 1rem;
    border-radius: 12px;
    font-size: 0.87rem;
    margin-bottom: 1.25rem;
    border: 1px solid;
    line-height: 1.5;
}
.alert.ok   { background: rgba(70,198,138,0.1); border-color: rgba(70,198,138,0.3); color: #b8f0d5; }
.alert.err  { background: var(--danger-soft); border-color: rgba(240,97,109,0.35); color: #ffc9ce; }
.alert.warn { background: rgba(245,196,81,0.1); border-color: rgba(245,196,81,0.3); color: #f7e2b0; }
.alert i { margin-top: 0.15rem; }
.alert a { color: inherit; text-decoration: underline; }

/* ============================================================
   PAGE / PROJECT LISTS
   ============================================================ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1rem; }

.tile {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: border-color .2s ease, transform .2s ease;
}
.tile:hover { border-color: var(--line-strong); transform: translateY(-2px); }

.tile-top { display: flex; align-items: flex-start; gap: 0.85rem; }
.tile-logo {
    flex: 0 0 46px; height: 46px;
    border-radius: 10px;
    background: #fff;
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; padding: 4px;
}
.tile-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.tile-logo.empty { background: var(--panel-2); border: 1px dashed var(--line-strong); color: var(--text-3); }

.tile-title { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.tile-handle {
    font-size: 0.78rem;
    color: var(--accent-bright);
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace;
    word-break: break-all;
}
.tile-meta { font-size: 0.76rem; color: var(--text-3); display: flex; gap: 0.75rem; flex-wrap: wrap; }
.tile-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: auto; padding-top: 0.35rem; }

.pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    padding: 0.22rem 0.6rem; border-radius: 100px;
}
.pill.live  { color: #8ff0c2; background: rgba(70,198,138,0.14); }
.pill.draft { color: #f7dfa8; background: rgba(245,196,81,0.14); }

.tile.shadowed { border-color: rgba(245,196,81,0.45); }
.tile-warn {
    display: flex; gap: 0.55rem; align-items: flex-start;
    font-size: 0.76rem; line-height: 1.45;
    color: #f7e2b0;
    background: rgba(245,196,81,0.1);
    border: 1px solid rgba(245,196,81,0.28);
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}
.tile-warn code { color: #fff; font-family: ui-monospace, Consolas, monospace; }

/* Project library tiles */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem; }

.lib-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex; flex-direction: column;
    transition: border-color .2s ease, transform .2s ease;
}
.lib-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }

.lib-thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    background: #05070d;
    overflow: hidden;
}
.lib-thumb img, .lib-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-thumb .none {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    color: #2b3245; font-size: 1.6rem;
}
.lib-kind {
    position: absolute; top: 0.5rem; right: 0.5rem;
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
    padding: 0.2rem 0.5rem; border-radius: 100px;
    background: rgba(0,0,0,0.65); color: #cfd7e6; backdrop-filter: blur(6px);
}
.lib-body { padding: 0.85rem 0.9rem; display: flex; flex-direction: column; gap: 0.4rem; flex: 1; }
.lib-tag { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-bright); }
.lib-title { font-size: 0.92rem; font-weight: 600; line-height: 1.25; }
.lib-desc {
    font-size: 0.76rem; color: var(--text-2); line-height: 1.45;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-foot { display: flex; gap: 0.4rem; padding: 0.6rem 0.9rem 0.85rem; flex-wrap: wrap; }

/* ============================================================
   BUILDER — selected cards list
   ============================================================ */
.builder-cards { display: flex; flex-direction: column; gap: 0.6rem; }

.bcard {
    display: flex; align-items: stretch; gap: 0.85rem;
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.7rem 0.8rem;
    transition: border-color .2s ease, box-shadow .2s ease, opacity .2s ease;
}
.bcard.dragging { opacity: 0.4; }
.bcard.drop-target { border-color: var(--accent-border); box-shadow: 0 0 0 2px var(--accent-soft); }
.bcard.missing { border-color: rgba(240,97,109,0.4); }

.bcard-handle {
    display: flex; align-items: center; justify-content: center;
    color: var(--text-3); cursor: grab; padding: 0 0.15rem; flex: 0 0 auto;
}
.bcard-handle:active { cursor: grabbing; }

.bcard-thumb {
    flex: 0 0 60px; height: 60px;
    border-radius: 8px; overflow: hidden; background: #05070d;
    display: flex; align-items: center; justify-content: center; color: #2b3245;
}
.bcard-thumb img, .bcard-thumb video { width: 100%; height: 100%; object-fit: cover; }

.bcard-main { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.15rem; }
.bcard-title { font-size: 0.9rem; font-weight: 600; }
.bcard-sub { font-size: 0.75rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard-badge { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-bright); }

.bcard-side { display: flex; align-items: center; gap: 0.3rem; flex: 0 0 auto; }

.bcard-overrides {
    display: none;
    border-top: 1px dashed var(--line);
    margin-top: 0.7rem;
    padding-top: 0.7rem;
    gap: 0.6rem;
    flex-direction: column;
}
.bcard.open .bcard-overrides { display: flex; }
.bcard.open { flex-wrap: wrap; }
.bcard-overrides { width: 100%; }
.bcard-overrides input, .bcard-overrides textarea { font-size: 0.84rem; }

.empty-slot {
    border: 1px dashed var(--line-strong);
    border-radius: 12px;
    padding: 2rem 1rem;
    text-align: center;
    color: var(--text-3);
    font-size: 0.87rem;
}

/* Library picker inside the builder */
.picker {
    max-height: 560px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.7rem;
    padding-right: 0.25rem;
}
.pick {
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    font-family: var(--font);
    color: var(--text);
    padding: 0;
    transition: border-color .18s ease, transform .18s ease;
    position: relative;
}
.pick:hover { border-color: var(--accent-border); transform: translateY(-2px); }
.pick .pthumb { aspect-ratio: 16 / 10; background: #05070d; overflow: hidden; display: flex; align-items: center; justify-content: center; color: #2b3245; }
.pick .pthumb img, .pick .pthumb video { width: 100%; height: 100%; object-fit: cover; }
.pick .pbody { padding: 0.5rem 0.6rem 0.65rem; }
.pick .ptitle { font-size: 0.8rem; font-weight: 600; line-height: 1.25; }
.pick .ptag { font-size: 0.6rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-bright); margin-bottom: 0.15rem; }
.pick .pkind {
    position: absolute; top: 0.4rem; left: 0.4rem;
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.62rem; color: #d9c4ff;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
}
.pick .pthumb { position: relative; }
.pick .pwarn { font-size: 0.65rem; color: var(--warn); margin-top: 0.15rem; }

.bcard.is-video .bcard-thumb { position: relative; }
.bcard.is-video .bcard-thumb::after {
    content: "\f144";                       /* circle-play */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.9);
    font-size: 1.1rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.7);
    pointer-events: none;
}

.pick .padd {
    position: absolute; top: 0.4rem; right: 0.4rem;
    width: 24px; height: 24px; border-radius: 50%;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
    font-size: 0.7rem; color: #fff;
}
.pick.in-use { opacity: 0.55; }
.pick.in-use .padd { background: var(--accent); color: #04181c; }

.picker-search { margin-bottom: 0.85rem; }

/* ============================================================
   MEDIA PREVIEW (project editor)
   ============================================================ */
.media-preview {
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    background: #05070d;
    aspect-ratio: 16 / 10;
    display: flex; align-items: center; justify-content: center;
    color: #2b3245; font-size: 2rem;
    margin-bottom: 0.75rem;
}
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; }

.logo-preview {
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    padding: 0.75rem;
    height: 84px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 0.75rem;
}
.logo-preview img { max-height: 100%; max-width: 100%; object-fit: contain; }
.logo-preview.empty { background: var(--panel-2); border-style: dashed; color: var(--text-3); font-size: 0.82rem; }

/* ============================================================
   STICKY SAVE BAR
   ============================================================ */
.savebar {
    position: sticky;
    bottom: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding: 0.9rem 1.15rem;
    background: rgba(13, 16, 26, 0.92);
    backdrop-filter: blur(14px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.savebar .live-url { font-size: 0.8rem; color: var(--text-3); word-break: break-all; }
.savebar .live-url code { color: var(--accent-bright); font-family: ui-monospace, Consolas, monospace; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-wrap {
    min-height: 100dvh;
    display: flex; align-items: center; justify-content: center;
    padding: 2rem;
    position: relative; overflow: hidden;
}
.login-orb {
    position: absolute; width: 620px; height: 620px; border-radius: 50%;
    filter: blur(110px); pointer-events: none;
    background: radial-gradient(circle, rgba(49,166,183,0.2) 0%, transparent 70%);
    top: -240px; left: -180px;
}
.login-card {
    position: relative; z-index: 1;
    width: min(400px, 100%);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 2rem 1.9rem;
    box-shadow: 0 24px 70px rgba(0,0,0,0.55);
}
.login-card img.logo { height: 44px; mix-blend-mode: screen; filter: brightness(1.35); margin-bottom: 1.25rem; }
.login-card h1 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.login-card p.sub { color: var(--text-2); font-size: 0.85rem; margin: 0.3rem 0 1.5rem; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 0.5rem; }

/* ============================================================
   MISC
   ============================================================ */
.copy-ok { color: var(--ok) !important; }
.muted { color: var(--text-3); }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 0.82rem; }
.divider { height: 1px; background: var(--line); margin: 1.25rem 0; }
.spacer { flex: 1; }

@media (max-width: 1080px) {
    .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    .shell { flex-direction: column; }
    .sidebar {
        position: static; height: auto; flex: 0 0 auto;
        flex-direction: row; align-items: center; gap: 0.75rem;
        overflow-x: auto; padding: 0.75rem 1rem;
        border-right: none; border-bottom: 1px solid var(--line);
    }
    .brand span { display: none; }
    .nav { flex-direction: row; flex: 1; }
    .nav-item span { display: none; }
    .sidebar-foot { flex-direction: row; border-top: none; padding-top: 0; }
    .who { display: none; }
    .content { padding: 1.25rem 1rem 3rem; }
}
