/* ============================================================
   ELink — shared design system
   ============================================================ */

:root {
    --bg: #06080f;
    --text: #e9edf7;
    --muted: #8a94ab;
    --line: rgba(255, 255, 255, 0.09);
    --panel: rgba(255, 255, 255, 0.045);
    --panel-2: rgba(255, 255, 255, 0.07);

    --primary: #5b8cff;
    --primary-2: #8b5cf6;
    --success: #2ee08a;
    --danger: #ff5470;

    --accent: #5b8cff;
    --accent-2: #8b5cf6;

    --radius: 18px;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);

    --font: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, Arial, sans-serif;
    --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

/* per-page accents */
.page-drive   { --accent: #4f8cff; --accent-2: #2ee08a; }
.page-youtube { --accent: #ff2d55; --accent-2: #ff8a3d; }
.page-mega    { --accent: #ff4136; --accent-2: #ffb020; }
.page-home    { --accent: #5b8cff; --accent-2: #8b5cf6; }

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font);
    color: var(--text);
    background-color: var(--bg);
    background-image:
        radial-gradient(900px 520px at 12% -8%, rgba(91, 140, 255, 0.22), transparent 60%),
        radial-gradient(820px 460px at 108% 4%, rgba(139, 92, 246, 0.20), transparent 58%),
        radial-gradient(900px 620px at 50% 118%, rgba(46, 224, 138, 0.10), transparent 62%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    position: relative;
}

/* faint "digital" grid */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 46px 46px;
    -webkit-mask-image: radial-gradient(circle at 50% 26%, #000 0%, transparent 76%);
    mask-image: radial-gradient(circle at 50% 26%, #000 0%, transparent 76%);
}

.wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 700px;
    margin: 0 auto;
    padding: 20px 16px 64px;
}

/* ---------- top bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    letter-spacing: 0.2px;
    font-size: 16px;
}

.brand img {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    padding: 3px;
}

.nav {
    display: flex;
    gap: 3px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
}

.nav::-webkit-scrollbar { display: none; }

.nav a {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 7px 13px;
    border-radius: 999px;
    transition: color 0.18s, background 0.18s;
}

.nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }

.nav a.active {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* ---------- card ---------- */

.card {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.062), rgba(255, 255, 255, 0.025));
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 26px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- tool header ---------- */

.tool-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.tool-icon {
    flex: 0 0 auto;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
}

.tool-icon svg { width: 25px; height: 25px; }

.tool-icon img,
.tc-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 3px;
    border-radius: inherit;
    box-sizing: border-box;
}

.tool-head h1 {
    margin: 0;
    font-size: 19px;
    letter-spacing: -0.01em;
}

.tool-head p {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--muted);
}

/* ---------- fields ---------- */

.field { margin-bottom: 16px; }

label {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

input[type="text"], input[type="password"] {
    width: 100%;
    padding: 14px 15px;
    font-family: inherit;
    font-size: 15px;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 13px;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}

input[type="text"]::placeholder,
input[type="password"]::placeholder { color: #5f6a82; }

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 4px rgba(91, 140, 255, 0.15);
}

/* ---------- options ---------- */

.options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin: 2px 0 18px;
}

.opt {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 13.5px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--text);
    cursor: pointer;
    user-select: none;
}

.opt input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

/* ---------- buttons ---------- */

.btn {
    border: none;
    border-radius: 13px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    padding: 13px 16px;
    cursor: pointer;
    transition: transform 0.12s, box-shadow 0.22s, background 0.18s, filter 0.18s;
}

.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.4);
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    text-decoration: none;
    text-align: center;
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.11); }

.btn.done {
    background: linear-gradient(135deg, #2ee08a, #14b866);
    box-shadow: 0 12px 26px rgba(46, 224, 138, 0.28);
}

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .btn { flex: 1 1 0; }

/* ---------- output ---------- */

.output {
    display: block;
    padding: 12px 13px;
    font-family: var(--mono);
    font-size: 12.5px;
    line-height: 1.6;
    color: #cfe0ff;
    background: rgba(4, 8, 18, 0.6);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow-wrap: anywhere;
    word-break: break-word;
    min-height: 18px;
}

.group { margin-top: 20px; }

.result {
    display: none;
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.result.show {
    display: block;
    animation: fade 0.35s ease both;
}

@keyframes fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}

.frame {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    min-height: 180px;
    background: #000;
    border: 1px solid var(--line);
    border-radius: 14px;
}

/* ---------- landing ---------- */

.hero {
    text-align: center;
    padding: 26px 6px 6px;
    animation: rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.big-logo {
    width: 90px;
    height: 90px;
    object-fit: contain;
    border-radius: 26px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.hero h1 {
    margin: 18px 0 10px;
    font-size: clamp(26px, 6vw, 36px);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.grad {
    background: linear-gradient(120deg, #5b8cff, #8b5cf6 50%, #2ee08a);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    max-width: 470px;
    margin: 0 auto;
    font-size: 14.5px;
    line-height: 1.65;
    color: var(--muted);
}

.tools {
    display: grid;
    gap: 14px;
    margin-top: 30px;
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 17px 18px;
    color: var(--text);
    text-decoration: none;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.022));
    transition: transform 0.18s, border-color 0.18s, box-shadow 0.28s;
    animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.tool-card:nth-child(2) { animation-delay: 0.06s; }
.tool-card:nth-child(3) { animation-delay: 0.12s; }

.tool-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 20px 46px rgba(0, 0, 0, 0.5);
}

.tc-icon {
    flex: 0 0 auto;
    width: 52px;
    height: 52px;
    border-radius: 15px;
    display: grid;
    place-items: center;
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.4);
}

.tc-icon svg { width: 27px; height: 27px; }

.tool-card h3 { margin: 0 0 4px; font-size: 16px; }
.tool-card p { margin: 0; font-size: 13px; color: var(--muted); }

.arrow {
    margin-left: auto;
    font-size: 20px;
    color: var(--muted);
    transition: transform 0.2s, color 0.2s;
}

.tool-card:hover .arrow { color: #fff; transform: translateX(4px); }

.foot {
    margin-top: 30px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
    letter-spacing: 0.02em;
}

/* ---------- toast ---------- */

.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 60;
    padding: 11px 17px;
    font-size: 13.5px;
    font-weight: 600;
    color: #fff;
    background: rgba(10, 14, 24, 0.92);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transform: translate(-50%, 16px);
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive / a11y ---------- */

@media (max-width: 420px) {
    .wrap { padding: 16px 12px 54px; }
    .card { padding: 20px 17px; border-radius: 19px; }
    .nav a { padding: 7px 10px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ============================================================
   Stream page — player, library & admin panel
   ============================================================ */

.page-stream { --accent: #7c5cff; --accent-2: #22d3ee; }

.admin-btn {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 9px 15px;
    font-size: 13px;
}

/* ---------- player ---------- */

.player {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: radial-gradient(circle at 50% 40%, #101728, #05070d 75%);
    border: 1px solid var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 26px 60px rgba(0, 0, 0, 0.55);
}

.player iframe,
.player video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

.player-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 20px;
    text-align: center;
    color: var(--muted);
}

.player-empty .glyph { font-size: 34px; opacity: 0.55; }
.player-empty b { color: var(--text); font-size: 15px; }
.player-empty span { font-size: 13px; }

.player-meta {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 15px;
}

.player-meta .pm-text { min-width: 0; flex: 1 1 180px; }
.player-meta h2 { margin: 0 0 6px; font-size: 17px; line-height: 1.3; }
.player-meta p { margin: 6px 0 0; font-size: 13px; line-height: 1.55; color: var(--muted); }

.pm-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pm-actions .btn { padding: 9px 13px; font-size: 12.5px; flex: 0 0 auto; }

/* ---------- chips / badges ---------- */

.badge {
    display: inline-block;
    padding: 4px 9px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border-radius: 999px;
    color: var(--muted);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
}

.badge.youtube { color: #ff8ea0; background: rgba(255, 45, 85, 0.13); border-color: rgba(255, 45, 85, 0.35); }
.badge.mega    { color: #ff9c92; background: rgba(255, 65, 54, 0.13); border-color: rgba(255, 65, 54, 0.35); }
.badge.drive   { color: #9dbcff; background: rgba(79, 140, 255, 0.13); border-color: rgba(79, 140, 255, 0.35); }
.badge.direct  { color: #82f2c4; background: rgba(46, 224, 138, 0.13); border-color: rgba(46, 224, 138, 0.35); }
.badge.embed   { color: #cdbbff; background: rgba(139, 92, 246, 0.14); border-color: rgba(139, 92, 246, 0.35); }

/* ---------- library ---------- */

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin: 28px 0 14px;
}

.section-head h2 { margin: 0; font-size: 16px; }
.section-head .count { margin-left: 8px; font-size: 13px; font-weight: 500; color: var(--muted); }
.search { flex: 0 1 200px; }
.search input { padding: 10px 12px; font-size: 13.5px; }

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
    gap: 14px;
}

.vcard {
    position: relative;
    overflow: hidden;
    text-align: left;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
    cursor: pointer;
    transition: transform 0.16s, border-color 0.16s, box-shadow 0.24s;
    font-family: inherit;
    color: var(--text);
}

.vcard:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 18px 42px rgba(0, 0, 0, 0.5);
}

.vcard.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(124, 92, 255, 0.3); }

.vthumb {
    position: relative;
    aspect-ratio: 16 / 9;
    display: grid;
    place-items: center;
    background: #0a0e18 center / cover no-repeat;
}

.vthumb .ph { font-size: 26px; opacity: 0.5; }

.vplay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    background: linear-gradient(180deg, rgba(3, 5, 12, 0.1), rgba(3, 5, 12, 0.55));
    transition: opacity 0.2s;
}

.vcard:hover .vplay { opacity: 1; }

.vplay span {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.92);
    color: #0b1020;
    font-size: 15px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.5);
}

.vbody { padding: 10px 11px 12px; }

.vbody h4 {
    margin: 0 0 7px;
    font-size: 13.5px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.vbody .badge { font-size: 10px; padding: 3px 7px; }

.empty {
    grid-column: 1 / -1;
    padding: 42px 20px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 16px;
    font-size: 13.5px;
    line-height: 1.6;
}

.empty .big { display: block; font-size: 30px; margin-bottom: 10px; opacity: 0.6; }
.empty .btn { margin-top: 16px; }

/* ---------- drawer + overlay ---------- */

.overlay {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(3, 5, 12, 0.62);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

.overlay.show { opacity: 1; pointer-events: auto; }

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 45;
    width: min(430px, 94vw);
    height: 100%;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #0a0f1c, #070a13);
    border-left: 1px solid var(--line);
    box-shadow: -30px 0 80px rgba(0, 0, 0, 0.6);
    transform: translateX(103%);
    transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.drawer.open { transform: none; }

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 18px 18px 13px;
    border-bottom: 1px solid var(--line);
}

.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 18px; border-top: 1px solid var(--line); }

.icon-btn {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 19px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.18s;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.13); }

/* ---------- admin form ---------- */

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }

.stat {
    padding: 12px 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.03);
}

.stat b { display: block; font-size: 22px; line-height: 1.1; }
.stat span { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }

.admin-form { margin-bottom: 22px; }
.admin-form .field { margin-bottom: 13px; }
.admin-form .row .btn { flex: 1 1 0; }

textarea {
    width: 100%;
    min-height: 68px;
    padding: 12px 13px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: none;
    resize: vertical;
    transition: border-color 0.18s, box-shadow 0.18s;
}

textarea::placeholder { color: #5f6a82; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.15); }

.list-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 4px 0 10px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.admin-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px;
    margin-bottom: 8px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
}

.ai-thumb {
    flex: 0 0 auto;
    width: 54px;
    height: 32px;
    border-radius: 7px;
    background: #0a0e18 center / cover no-repeat;
    border: 1px solid var(--line);
}

.ai-main { flex: 1 1 auto; min-width: 0; }
.ai-main b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-main small { font-size: 11px; color: var(--muted); }

.ai-tools { display: flex; gap: 5px; flex: 0 0 auto; }

.mini {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.16s, border-color 0.16s;
}

.mini:hover { background: rgba(255, 255, 255, 0.14); }
.mini.danger:hover { background: rgba(255, 84, 112, 0.24); border-color: rgba(255, 84, 112, 0.5); }

/* ---------- passcode modal ---------- */

.modal {
    position: fixed;
    inset: 0;
    z-index: 55;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(3, 5, 12, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.modal.show { display: flex; }

.modal-box {
    width: 100%;
    max-width: 350px;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
    box-shadow: var(--shadow);
    animation: rise 0.3s ease both;
}

.modal-box h3 { margin: 0 0 6px; font-size: 17px; }
.modal-box p { margin: 0 0 16px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.modal-box .row { margin-top: 16px; }

.hidden { display: none !important; }

@media (max-width: 420px) {
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
