/* ClipBoard - shared styles */

:root {
    --bg: #f6f7f9;
    --bg-soft: #eceef2;
    --surface: #ffffff;
    --surface-2: #f8f9fb;
    --border: #e2e5ea;
    --border-strong: #cfd4dc;
    --text: #15181d;
    --muted: #666d79;
    --faint: #8b929d;
    --accent: #3b5bdb;
    --accent-ink: #ffffff;
    --accent-soft: #e7ecfd;
    --ok: #0f9d58;
    --ok-soft: #e4f6ec;
    --danger: #d64545;
    --danger-soft: #fdeaea;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px -12px rgba(16, 24, 40, .14);
    --radius: 14px;
    --radius-sm: 9px;
    --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0f1115;
        --bg-soft: #15181e;
        --surface: #181b21;
        --surface-2: #1e222a;
        --border: #272c35;
        --border-strong: #353b47;
        --text: #e9ecf1;
        --muted: #98a0ad;
        --faint: #6f7785;
        --accent: #7c93f5;
        --accent-ink: #0f1115;
        --accent-soft: #212842;
        --ok: #3ccb7f;
        --ok-soft: #14271d;
        --danger: #f08181;
        --danger-soft: #2a1718;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
    }
}

:root[data-theme="dark"] {
    --bg: #0f1115;
    --bg-soft: #15181e;
    --surface: #181b21;
    --surface-2: #1e222a;
    --border: #272c35;
    --border-strong: #353b47;
    --text: #e9ecf1;
    --muted: #98a0ad;
    --faint: #6f7785;
    --accent: #7c93f5;
    --accent-ink: #0f1115;
    --accent-soft: #212842;
    --ok: #3ccb7f;
    --ok-soft: #14271d;
    --danger: #f08181;
    --danger-soft: #2a1718;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Hind Siliguri", "Noto Sans Bengali", system-ui, -apple-system,
        "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

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

.wrap {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 16px;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.topbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 62px;
    flex-wrap: wrap;
    padding: 10px 16px;
    max-width: 1180px;
    margin: 0 auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -.01em;
    text-decoration: none;
    color: var(--text);
    margin-right: auto;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--accent);
    color: var(--accent-ink);
    flex: 0 0 auto;
}

.brand-mark svg { width: 17px; height: 17px; }

.brand small {
    display: block;
    font-weight: 500;
    font-size: 11.5px;
    color: var(--faint);
    letter-spacing: 0;
}

/* ---------- search ---------- */

.search {
    position: relative;
    flex: 1 1 240px;
    min-width: 0;
    max-width: 420px;
}

.search > svg {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--faint);
    pointer-events: none;
}

.search input {
    width: 100%;
    padding: 9px 12px 9px 34px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

.search input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: transparent;
}

.search kbd {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);
    font: 500 11px/1 var(--mono);
    color: var(--faint);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 3px 5px;
    pointer-events: none;
}

.search input:not(:placeholder-shown) ~ kbd { display: none; }

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background .14s, border-color .14s, transform .08s, color .14s;
}

.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; flex: 0 0 auto; }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-ink);
}

.btn-primary:hover {
    background: var(--accent);
    filter: brightness(.92);
    border-color: var(--accent);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); border-color: transparent; }

.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }

.btn-icon { padding: 9px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }

.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- layout ---------- */

main { padding: 26px 0 60px; }

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.page-head h1 {
    margin: 0;
    font-size: 23px;
    font-weight: 700;
    letter-spacing: -.02em;
}

.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.count-pill {
    font-size: 13px;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 5px 11px;
    white-space: nowrap;
}

/* ---------- public list: one snippet, one line ---------- */

.list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 860px;
    margin: 0 auto;
}

.line {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    padding: 9px 9px 9px 13px;
}

/* The whole text is shown - line breaks and all. */
.line-text {
    flex: 1;
    min-width: 0;
    padding-top: 6px;
    font-family: var(--mono);
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

/* Fits both "Copy" and "Copied!" so the row never jumps width. */
.line .btn-copy {
    flex: 0 0 auto;
    min-width: 98px;
    background: transparent;
    border-color: var(--border-strong);
    color: var(--accent);
}

.line .btn-copy:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}

.btn-copy.copied {
    background: var(--ok);
    border-color: var(--ok);
    color: #fff;
    filter: none;
}

/* Keep the copied state transparent too - just green text and border. */
.line .btn-copy.copied {
    background: transparent;
    border-color: var(--ok);
    color: var(--ok);
}

/* ---------- empty state ---------- */

.empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--muted);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    background: var(--surface);
}

.empty svg { width: 36px; height: 36px; color: var(--faint); margin-bottom: 10px; }
.empty h3 { margin: 0 0 6px; color: var(--text); font-size: 17px; }
.empty p { margin: 0; font-size: 14px; }

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

.toast-host {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
    width: max-content;
    max-width: calc(100vw - 32px);
}

.toast {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--text);
    color: var(--bg);
    padding: 10px 15px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
    animation: toast-in .2s ease;
}

.toast.err { background: var(--danger); color: #fff; }
.toast svg { width: 16px; height: 16px; flex: 0 0 auto; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(10px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

/* ---------- footer ---------- */

.foot {
    border-top: 1px solid var(--border);
    padding: 18px 0 30px;
    color: var(--faint);
    font-size: 13px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 560px) {
    body { font-size: 14.5px; }
    .line { padding: 7px 8px 7px 11px; gap: 8px; }
    .brand small { display: none; }
    .page-head h1 { font-size: 20px; }
    .btn-label-sm { display: none; }
}
