/*
 * skwurl.io — one stylesheet for every page.
 * Same look as the skwurl.io and Proto Squirrel splash pages: purple
 * gradient, frosted-glass cards, white text, pill-shaped buttons.
 *
 * Narrow pages (splash, sign-in, register, errors) keep the splash page's
 * generous proportions; the admin dashboard is deliberately compact.
 */

:root {
    --grad-start: #667eea;
    --grad-end: #764ba2;
    --text: #fff;
    --text-muted: rgba(255, 255, 255, 0.75);
    --glass: rgba(255, 255, 255, 0.1);
    --glass-strong: rgba(255, 255, 255, 0.2);
    --glass-hover: rgba(255, 255, 255, 0.3);
    --glass-border: rgba(255, 255, 255, 0.18);
    --control-border: rgba(255, 255, 255, 0.3);
    --shade: rgba(0, 0, 0, 0.2);
    --ok: #4caf50;
    --danger: #ff6b6b;
    --warn: #ffc107;
    --radius: 12px;
    --shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    --font: Arial, Helvetica, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* No background on <html>: the body's gradient then fills the whole window. */
body {
    margin: 0 auto;
    min-height: 100vh;
    padding: 20px;
    font-family: var(--font);
    font-size: 15px;
    color: var(--text);
    background: linear-gradient(135deg, var(--grad-start) 0%, var(--grad-end) 100%) fixed;
    line-height: 1.45;
}

.layout-narrow { max-width: 650px; padding-top: 80px; text-align: center; font-size: 16px; }
.layout-wide { max-width: 960px; }

a { color: inherit; }

h1 {
    font-size: 3em;
    margin: 0 0 20px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

h2 { font-size: 1.05em; margin: 0 0 12px; }

code, .token { font-family: var(--mono); }

:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* ---- Cards ------------------------------------------------------------ */

.card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    padding: 16px 18px;
}

.container { padding: 40px; border-radius: 15px; }

/* minmax(0, 1fr): let cards shrink to the page instead of growing to fit long URLs. */
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

.card-head {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.card-head h2 { margin: 0; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 14px; align-items: start; }

/* ---- Splash bits -------------------------------------------------------- */

.logo-round {
    display: block;
    margin: 0 auto 24px;
    width: 65%;
    max-width: 200px;
    border-radius: 50%;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.3));
}
.logo-sm { max-width: 110px; margin-bottom: 16px; }

.subtitle { font-size: 1.2em; margin: 0 0 30px; opacity: 0.9; }

.features { list-style: none; padding: 0; margin: 40px 0 0; text-align: left; }
.features li { margin: 15px 0; font-size: 1.1em; }
.features li::before { content: "✓ "; color: var(--ok); font-weight: bold; }

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    justify-content: center;
    margin-top: 28px;
}

/* ---- Buttons and links ------------------------------------------------- */

.btn {
    display: inline-block;
    padding: 7px 16px;
    font: bold 0.9em var(--font);
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    background: var(--glass-strong);
    border: 1px solid var(--control-border);
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.btn:hover { background: var(--glass-hover); transform: translateY(-1px); box-shadow: 0 4px 15px var(--shade); }
.btn:disabled { opacity: 0.6; cursor: progress; transform: none; box-shadow: none; }
.btn-sm { padding: 3px 10px; font-size: 0.78em; }
.btn-danger { background: rgba(255, 107, 107, 0.25); border-color: rgba(255, 140, 140, 0.6); }
.btn-danger:hover { background: rgba(255, 107, 107, 0.45); }

/* Splash-sized buttons on the narrow pages, as on skwurl.io / Proto Squirrel. */
.layout-narrow .btn { padding: 14px 30px; font-size: 1.05em; border-width: 2px; }
.layout-narrow .btn:hover { transform: translateY(-2px); }

.link {
    padding: 0;
    font: inherit;
    color: var(--text-muted);
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.link:hover { color: var(--text); }

.pill {
    padding: 4px 12px;
    font-size: 0.9em;
    color: var(--text);
    text-decoration: none;
    border-radius: 999px;
    border: 1px solid transparent;
}
.pill:hover { background: var(--glass); }
.pill.is-active { background: var(--glass-strong); border-color: var(--control-border); }

/* ---- Admin header ------------------------------------------------------- */

.topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 16px;
    padding: 8px 14px;
    margin-bottom: 14px;
}
.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
}
.brand-logo { width: 30px; height: 30px; border-radius: 50%; }
.topnav { display: flex; gap: 4px; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; font-size: 0.9em; }

/* ---- Forms -------------------------------------------------------------- */

.form { display: grid; gap: 8px; text-align: left; }
.form-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) auto; align-items: end; gap: 10px; }
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-inline input { width: auto; flex: 0 1 180px; }

label { font-weight: bold; font-size: 0.85em; }
.field { display: grid; gap: 4px; min-width: 0; }

input[type="text"], input[type="url"], input[type="number"] {
    width: 100%;
    padding: 6px 10px;
    font: 0.95em var(--font);
    color: var(--text);
    background: var(--glass);
    border: 1px solid var(--control-border);
    border-radius: 8px;
}
input::placeholder { color: rgba(255, 255, 255, 0.55); }
input:focus { outline: none; border-color: #fff; background: var(--glass-strong); }

.layout-narrow .form { gap: 12px; }
.layout-narrow .form .btn { justify-self: center; margin-top: 8px; }
.layout-narrow label { font-size: 1em; }
.layout-narrow input[type="text"] { padding: 13px 16px; font-size: 1em; border-width: 2px; border-radius: 12px; }

.status { min-height: 1.5em; margin: 12px 0 0; color: var(--text-muted); }
.status.is-error { color: #ffd1d1; font-weight: bold; }

.steps {
    display: flex;
    justify-content: center;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0 0 28px;
    counter-reset: step;
}
.steps li {
    counter-increment: step;
    padding: 8px 18px;
    border-radius: 999px;
    font-size: 0.9em;
    background: var(--glass);
    color: var(--text-muted);
}
.steps li::before { content: counter(step) ". "; }
.steps li.is-current { background: var(--glass-strong); color: var(--text); font-weight: bold; border: 1px solid var(--control-border); }
.steps li.is-done::before { content: "✓ "; color: var(--ok); }

/* ---- Messages ----------------------------------------------------------- */

.alert {
    margin: 0 0 14px;
    padding: 8px 12px;
    font-size: 0.9em;
    text-align: left;
    border-radius: 8px;
    border-left: 4px solid;
    background: var(--glass-strong);
}
.stack > .alert { margin: 0; }
.alert-success { border-color: var(--ok); background: rgba(76, 175, 80, 0.25); }
.alert-error { border-color: var(--danger); background: rgba(255, 107, 107, 0.3); }
.alert-warning { border-color: var(--warn); background: rgba(255, 193, 7, 0.22); }

.toast {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 10;
    padding: 8px 16px;
    font-size: 0.9em;
    font-weight: bold;
    border-radius: 999px;
    background: rgba(76, 175, 80, 0.9);
    box-shadow: 0 4px 15px var(--shade);
}

.empty { color: var(--text-muted); text-align: center; padding: 12px 0; margin: 0; }
.muted { color: var(--text-muted); }

/* ---- Short links -------------------------------------------------------- */

.code-pill {
    display: inline-block;
    flex-shrink: 0;
    padding: 2px 8px;
    font-family: var(--mono);
    font-size: 0.9em;
    font-weight: bold;
    text-decoration: none;
    white-space: nowrap;
    border-radius: 6px;
    background: var(--shade);
}
.layout-narrow .code-pill { font-size: 1.2em; padding: 6px 14px; margin-bottom: 8px; white-space: normal; word-break: break-all; }

.result {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    font-size: 0.9em;
    border-radius: 8px;
    background: rgba(76, 175, 80, 0.2);
    border: 1px solid rgba(76, 175, 80, 0.5);
}
.result .code-pill { white-space: normal; word-break: break-all; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; }
.stat { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 10px 14px; }
.stat-number { font-size: 1.5em; font-weight: bold; text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.25); }
.stat-label { font-size: 0.75em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }

.link-list { list-style: none; margin: 0; padding: 0; }
.link-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 14px;
    padding: 7px 0;
    border-top: 1px solid var(--glass-border);
}
.link-main { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 280px; }
.link-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.88em; color: var(--text-muted); }
.link-meta, .row-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.85em; }
.link-meta form, .row-actions form { margin: 0; }

.badge {
    display: inline-block;
    padding: 1px 8px;
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
    border-radius: 999px;
    background: var(--glass-strong);
}
.badge-ok { background: rgba(76, 175, 80, 0.45); }

.danger-zone { margin-top: 12px; padding-top: 10px; font-size: 0.9em; border-top: 1px solid var(--glass-border); }
.danger-zone summary { cursor: pointer; color: var(--text-muted); }
.danger-zone .form { margin-top: 10px; }
.danger-zone code { padding: 1px 5px; border-radius: 4px; background: var(--shade); }

/* ---- Tables ------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88em; }
.table th, .table td { padding: 6px 8px; text-align: left; vertical-align: middle; border-top: 1px solid var(--glass-border); }
.table th { font-size: 0.8em; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); border-top: 0; }
.token { padding: 1px 6px; border-radius: 4px; background: var(--shade); }

.activity { list-style: none; margin: 0; padding: 0; font-size: 0.88em; }
.activity li { display: grid; gap: 1px; padding: 6px 0; border-top: 1px solid var(--glass-border); }
.activity li:first-child { border-top: 0; }

/* ---- Small screens (same breakpoints as the Proto Squirrel page) --------- */

@media (max-width: 768px) {
    body { padding: 12px; }
    .layout-narrow { padding-top: 20px; }
    .container { padding: 30px 18px; }
    h1 { font-size: 2.2em; }
    .form-grid, .split { grid-template-columns: minmax(0, 1fr); }
    .topnav { order: 3; flex-basis: 100%; }
}

@media (max-width: 480px) {
    body { padding: 8px; }
    .container { padding: 25px 12px; border-radius: 10px; }
    h1 { font-size: 1.8em; }
    .subtitle { font-size: 1em; }
}

@media (prefers-reduced-motion: reduce) {
    .btn { transition: none; }
    .btn:hover { transform: none; }
}
