/* shortlink.click — application styles */

:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --success-bg: #ecfdf5;
    --success-text: #065f46;
    --success-border: #a7f3d0;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --error-border: #fecaca;
    --warning-bg: #fffbeb;
    --warning-text: #92400e;
    --warning-border: #fde68a;
    --info-bg: #eff6ff;
    --info-text: #1e40af;
    --info-border: #bfdbfe;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container {
    width: 100%;
    max-width: 1040px;
    margin: 0 auto;
    padding: 0 20px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }

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

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 64px;
    flex-wrap: wrap;
}

.brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text);
}
.brand:hover { text-decoration: none; }

.nav {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.nav a { color: var(--muted); font-size: .94rem; font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.nav a.active { color: var(--primary); }
.nav a.btn { color: #fff; }
.nav a.btn:hover { color: #fff; }

.inline-form { display: inline; margin: 0; }

.main { flex: 1 0 auto; padding: 32px 20px 56px; }

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

.site-footer {
    flex-shrink: 0;
    border-top: 1px solid var(--border);
    background: var(--surface);
    color: var(--muted);
    font-size: .875rem;
    padding: 18px 0;
}
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer-links a { margin-left: 16px; color: var(--muted); }

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

.btn {
    display: inline-block;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: .94rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    cursor: pointer;
    text-align: center;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }

.btn-outline { background: transparent; border-color: var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--muted);
    padding: 6px 4px;
    font-weight: 500;
    font-size: .94rem;
}
.btn-ghost:hover { color: var(--text); text-decoration: underline; }

.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-sm { padding: 7px 14px; font-size: .875rem; }
.btn-lg { padding: 13px 26px; font-size: 1rem; }
.btn-block { display: block; width: 100%; }

/* ---------- hero / home ---------- */

.hero {
    text-align: center;
    padding: 40px 0 32px;
}
.hero h1 { font-size: 2.5rem; letter-spacing: -.02em; }
.lead {
    font-size: 1.12rem;
    color: var(--muted);
    max-width: 620px;
    margin: 0 auto 28px;
}
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
.hero-note { color: var(--muted); font-size: .94rem; }

.features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin: 24px 0 48px;
}
.feature {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
}
.feature-icon { font-size: 1.6rem; margin-bottom: 8px; }
.feature p { color: var(--muted); font-size: .94rem; margin: 0; }

.how {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
}
.steps { margin: 0 0 18px; padding-left: 22px; color: var(--muted); }
.steps li { margin-bottom: 8px; }
.steps strong { color: var(--text); }
.fine-print { color: var(--muted); font-size: .875rem; }
.how-cta { margin: 20px 0 0; }

/* ---------- cards & forms ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}
.card-narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.card-header h2 { margin: 0; }
.card-sub { color: var(--muted); font-size: .94rem; margin: -8px 0 20px; }

.field { margin-bottom: 18px; }
.field label {
    display: block;
    font-size: .9rem;
    font-weight: 600;
    margin-bottom: 6px;
}
.field input[type=text],
.field input[type=email],
.field input[type=url],
.field input[type=password],
.field input[type=number],
.field select {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    font: inherit;
    font-size: .96rem;
}
.field input:focus, .field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.field input.has-error { border-color: #dc2626; }
.field-error { color: var(--error-text); font-size: .85rem; margin-top: 6px; }
.field-hint { color: var(--muted); font-size: .85rem; margin-top: 6px; }

.form-footer { margin-top: 22px; text-align: center; color: var(--muted); font-size: .92rem; }

.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-row .field { flex: 1 1 240px; margin-bottom: 0; }

/* ---------- alerts ---------- */

.flashes { margin-bottom: 20px; }
.alert {
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: .94rem;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-border); }
.alert-error   { background: var(--error-bg);   color: var(--error-text);   border-color: var(--error-border); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); border-color: var(--warning-border); }
.alert-info    { background: var(--info-bg);    color: var(--info-text);    border-color: var(--info-border); }

/* ---------- stats ---------- */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 1.6rem; font-weight: 700; margin-top: 4px; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: .92rem;
}
table.data th, table.data td {
    padding: 11px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table.data th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
    white-space: nowrap;
}
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbff; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.truncate { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

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

/* ---------- misc ---------- */

code, .mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: .9em;
}
.token-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--primary-soft);
    border: 1px solid #c7d2fe;
    border-radius: var(--radius);
    padding: 14px 16px;
    flex-wrap: wrap;
}
.token-box code { font-size: 1rem; font-weight: 600; word-break: break-all; color: var(--primary-dark); }

pre.code {
    background: #0f172a;
    color: #e2e8f0;
    padding: 16px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: .86rem;
    line-height: 1.5;
}
pre.code .c { color: #94a3b8; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: .76rem;
    font-weight: 600;
}
.badge-admin { background: var(--primary-soft); color: var(--primary-dark); }
.badge-muted { background: #f1f5f9; color: var(--muted); }
.badge-ok { background: var(--success-bg); color: var(--success-text); }
.badge-no { background: var(--error-bg); color: var(--error-text); }

.error-page { text-align: center; padding: 48px 28px; }
.error-status { font-size: 3rem; font-weight: 800; color: var(--primary); margin: 0; line-height: 1; }

.section-title { margin: 32px 0 14px; }

.copy-link { display: flex; align-items: center; gap: 8px; }

@media (max-width: 640px) {
    .hero h1 { font-size: 1.9rem; }
    .card { padding: 20px; }
    .header-inner { min-height: 56px; padding-top: 10px; padding-bottom: 10px; }
}
