/* Self-hosted Ubuntu webfont - no third-party request. Templates also link
   fonts.css directly; this @import keeps the font available when style.css is
   loaded standalone. */
@import url('/static/css/fonts.css');

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

/* Fixed admin charter. Public pages override these via body.public (see the
   inline <style> in base.html), keeping admin immune to deployer theming. */
:root {
    --bg: #000;
    --fg: #e8e8e8;
    --text-color: #e8e8e8;
    --green: #096e09;
    --green-bright: #0db30d;
    --link-hover-color: #0a8a0a;
    --button-color: #0db30d;
    --button-text-color: #ffffff;
    --muted: #aaa;
    --border: #1f1f1f;
    --surface: #0a0a0a;
    --surface2: #111;
}

body {
    font-family: 'Ubuntu', sans-serif;
    background: var(--bg);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header ── */
header {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.logo {
    font-family: "Arial Black", "Helvetica Black", sans-serif;
    font-weight: 900;
    font-size: 1.4rem;
    text-decoration: none;
    letter-spacing: -0.5px;
}
.logo .logo-text { color: var(--green-bright); }
.logo-img-small {
    height: 2rem;
    width: auto;
    display: inline-block;
    vertical-align: middle;
}

/* ── Lang selector ── */
.lang-selector {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}
.lang-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Ubuntu', sans-serif;
    font-size: 0.8rem;
    transition: all 0.15s;
}
.lang-btn:hover { border-color: var(--green); color: var(--link-hover-color); }
.lang-btn.active { border-color: var(--green); color: var(--green-bright); background: rgba(9,110,9,0.1); }

/* ── Main ── */
main { flex: 1; }

/* ── Footer ── */
footer {
    padding: 1.5rem 2rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-color);
    border-top: 1px solid var(--border);
}

/* ── Home ── */
.home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 1.2rem;
    padding: 2rem;
}

.home-logo {
    font-family: "Arial Black", "Helvetica Black", sans-serif;
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -2px;
    line-height: 1;
}
.home-logo .logo-text { color: var(--green-bright); }
.logo-img-main {
    height: 3.5rem;
    width: auto;
    display: block;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .logo { font-size: 1.5rem; }
    .logo-img-small { height: 1.5rem; }
    .home-logo { font-size: 3rem; }
    .logo-img-main { height: 3rem; }
}

.tagline {
    color: var(--text-color);
    text-align: center;
    max-width: 480px;
    font-size: 1.2rem;
    font-weight: 300;
    line-height: 1.6;
}

.search-bar {
    display: flex;
    gap: 0;
    width: 100%;
    max-width: 580px;
}

.search-bar input[type="search"] {
    flex: 1;
    padding: 0.85rem 1.2rem;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--fg);
    font-family: 'Ubuntu', sans-serif;
    outline: none;
    transition: border-color 0.15s;
}
.search-bar input[type="search"]:focus { border-color: var(--border); }
.search-bar input[type="search"]::placeholder { color: var(--muted); }

.search-bar button {
    padding: 0.85rem 1.5rem;
    background: var(--button-color);
    color: var(--button-text-color);
    border: 1px solid var(--button-color);
    border-radius: 0 6px 6px 0;
    font-size: 1rem;
    font-family: 'Ubuntu', sans-serif;
    font-weight: 500;
    cursor: pointer;
}

.submit-link {
    font-size: 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.15s;
}
.submit-link:hover { color: var(--link-hover-color); }

/* ── Search results ── */
.search-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

.search-form {
    display: flex;
    gap: 0;
    margin-bottom: 2rem;
}
.search-form input[type="search"] {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--fg);
    font-family: 'Ubuntu', sans-serif;
    outline: none;
}
.search-form input[type="search"]:focus { border-color: var(--border); }
.search-form button {
    padding: 0.75rem 1.2rem;
    background: var(--button-color);
    color: var(--button-text-color);
    border: 1px solid var(--button-color);
    border-radius: 0 6px 6px 0;
    font-family: 'Ubuntu', sans-serif;
    cursor: pointer;
}

.results-meta {
    font-size: 0.85rem;
    color: var(--text-color);
    margin-bottom: 1.5rem;
    display: flex;
    gap: 1rem;
    align-items: center;
}
.results-meta a { color: var(--green-bright); text-decoration: none; }
.results-meta a:hover { color: var(--link-hover-color); }

.result-item {
    padding: 1.2rem 0;
    border-bottom: 1px solid var(--border);
}
.result-item:last-child { border-bottom: none; }

.result-title a {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--green-bright);
    text-decoration: none;
    line-height: 1.4;
}
.result-title a:hover { color: var(--link-hover-color); text-decoration: underline; }

.result-excerpt {
    margin-top: 0.4rem;
    font-size: 0.9rem;
    color: var(--text-color);
    line-height: 1.5;
    font-weight: 300;
}

.result-footer {
    margin-top: 0.5rem;
    display: flex;
    gap: 1rem;
    font-size: 0.78rem;
    color: var(--text-color);
    align-items: center;
}
.result-site { color: var(--green); }
.result-lang {
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}
.result-url {
    color: var(--muted);
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 400px;
}

.no-results {
    padding: 3rem 0;
    text-align: center;
    color: var(--text-color);
}

/* ── Submit ── */
.submit-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}
.submit-page h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.submit-intro {
    color: var(--text-color);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    font-weight: 300;
}
.alert {
    padding: 0.9rem 1.2rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}
/* Self-contained success banner: solid light-green fill + black text so it
   stays legible regardless of the configured page background (a translucent
   fill turned green-on-green unreadable on light themes). */
.alert-success { background: #d6f5d6; border: 2px solid var(--green-bright); color: #000; }
.alert-success a { color: #000; text-decoration: underline; }
/* Self-contained error banner: solid light-red fill + black text so it stays
   legible regardless of the configured page background (a translucent fill
   turned red-on-red unreadable). Mirror of .alert-success. */
.alert-error { background: #f5d6d6; border: 2px solid #b00; color: #000; }
.alert-error a { color: #000; text-decoration: underline; }
.banner-warn { background: rgba(200,150,0,0.15); border: 1px solid #c89600; border-left: 4px solid #fa3; color: #ffcc66; padding: 0.9rem 1.2rem; border-radius: 6px; margin-bottom: 1.5rem; font-size: 0.9rem; }
.banner-error { background:#7a1818; color:#fff; padding:1rem 1.5rem; margin-bottom:1.5rem; border-left:4px solid #fa3; border-radius:6px; }
.banner-ok { background:#14501a; color:#fff; padding:1rem 1.5rem; margin-bottom:1.5rem; border-left:4px solid var(--green-bright); border-radius:6px; }

.submit-form { display: flex; flex-direction: column; gap: 1.2rem; margin-bottom: 2.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-group label { font-size: 0.85rem; color: var(--text-color); font-weight: 500; }
.required { color: var(--green-bright); }
.form-group input,
.form-group textarea,
.form-group select {
    padding: 0.75rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--fg);
    font-family: 'Ubuntu', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--border); }
.form-group select option { background: var(--surface2); }

.btn-submit {
    padding: 0.85rem 2rem;
    background: var(--button-color);
    color: var(--button-text-color);
    border: none;
    border-radius: 6px;
    font-family: 'Ubuntu', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    align-self: flex-start;
}

.submit-rules {
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}
.submit-rules h2 { font-size: 0.95rem; color: var(--text-color); margin-bottom: 0.8rem; font-weight: 500; }
.submit-rules ul { list-style: none; display: flex; flex-direction: column; gap: 0.4rem; }
.submit-rules li { font-size: 0.85rem; color: var(--text-color); padding-left: 1.2rem; position: relative; font-weight: 300; }
.submit-rules li::before { content: '✓'; position: absolute; left: 0; color: var(--green); }
.submit-rules code { color: var(--text-color); background: var(--surface2); padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.8rem; }

/* ── Admin ── */
/* Note: .admin-page, .admin-table*, .row-danger, .cell-*, .admin-actions and
   the per-button .btn-accept/.btn-reject rules live in the "Admin / Moderate"
   section below (they shadowed earlier copies that were here). Kept here: the
   rules with no equivalent there - notably the shared .btn-accept/.btn-reject
   base, the sole source of the buttons' Ubuntu font and weight. */
.admin-page h2 { font-size: 1rem; color: var(--muted); margin: 2rem 0 1rem; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; }
.empty { color: #fff; font-size: 0.85rem; font-style: italic; }
.admin-table a { color: var(--green-bright); text-decoration: none; }
.admin-table a:hover { color: var(--link-hover-color); text-decoration: underline; }
.btn-accept, .btn-reject {
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
    border: none;
    font-family: 'Ubuntu', sans-serif;
    font-size: 0.78rem;
    cursor: pointer;
    font-weight: 500;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 0 1rem;
}
.page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.6rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.15s;
}
.page-btn:hover { border-color: var(--green); color: var(--link-hover-color); }
.page-btn.active { background: var(--green); border-color: var(--green); color: #fff; }
.page-btn.disabled { color: var(--muted); cursor: default; }
.page-ellipsis { color: var(--muted); padding: 0 0.2rem; }

/* ── Support ── */
.support-page {
    max-width: 600px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
.support-page h1 { font-size: 1.8rem; font-weight: 700; }
.support-intro { color: var(--text-color); font-size: 0.95rem; font-weight: 300; line-height: 1.6; }
.support-block { border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; }
.support-block h2 { font-size: 1rem; margin-bottom: 0.8rem; color: var(--green-bright); }
.support-block p { color: var(--text-color); font-size: 0.9rem; font-weight: 300; line-height: 1.6; }
.support-options { display: flex; gap: 1rem; flex-wrap: wrap; }
.support-btn {
    padding: 0.85rem 2rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: opacity 0.15s;
}
.support-btn:hover { opacity: 0.85; }
.liberapay { background: #f6c915; color: #000; }
.helloasso { background: #003189; color: #fff; }

/* ── Footer links ── */
.footer-links {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}
.footer-links a {
    color: var(--green-bright);
    text-decoration: none;
    font-size: 0.8rem;
    transition: color 0.15s;
}
.footer-links a:hover { color: var(--link-hover-color); }
.footer-sep { color: #555; font-size: 0.8rem; }
.footer-powered {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--text-color);
}
.footer-powered a { color: var(--green-bright); text-decoration: none; }
.footer-powered a:hover { color: var(--link-hover-color); text-decoration: underline; }

/* ── Admin / Moderate ── */
.admin-page { padding: 2rem; max-width: 1200px; margin: 0 auto; }
.admin-page h1 { font-size: 1.5rem; margin-bottom: 2rem; }
.mod-section { margin-bottom: 3rem; }
.mod-section h2 { font-size: 0.9rem; color: #fff; margin-bottom: 1rem; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; border-bottom: 1px solid var(--border); padding-bottom: 0.5rem; }
.mod-search { margin-bottom: 1rem; }
.mod-search input { width: 100%; max-width: 400px; background: #111; border: 1px solid var(--border); color: #fff; padding: 0.5rem 0.8rem; border-radius: 4px; font-size: 0.85rem; }
.mod-search input:focus { outline: none; border-color: var(--green); }
/* overflow-x:auto coerces overflow-y to auto (CSS spec), making this a scroll
   box on both axes. With border-collapse:collapse the last row's bottom border
   sits on the box edge and gets clipped; the 1px bottom padding keeps it inside
   the padding box so it renders fully. */
.admin-table-wrap { overflow-x: auto; padding-bottom: 1px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.admin-table th { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); color: #fff; font-weight: 500; white-space: nowrap; }
.admin-table td { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.admin-table td small { display: block; color: #aaa; font-size: 0.75rem; margin-top: 0.2rem; }
.admin-table td a { color: var(--green-bright); text-decoration: none; }
.admin-table td a:hover { color: var(--link-hover-color); text-decoration: underline; }
/* Keep .admin-actions as a real table-cell. display:flex on a <td> strips its
   table-cell display, so the cell stops stretching to the row height and its
   border-bottom floats up above the taller sibling cells (e.g. the 2-line Site
   cell) - the misaligned HR on action rows. Lay the actions out inline instead
   so the cell stretches normally and every row's border-bottom aligns. */
.admin-actions { white-space: nowrap; }
.admin-actions > * { display: inline-block; vertical-align: middle; }
.admin-actions > * + * { margin-left: 0.4rem; }
.btn-accept { background: var(--green); color: #fff; border: none; padding: 0.3rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }
.btn-reject { background: #8b0000; color: #fff; border: none; padding: 0.3rem 0.8rem; border-radius: 4px; cursor: pointer; font-size: 0.8rem; }
.btn-accept:hover { background: var(--link-hover-color); }
.btn-reject:hover { background: #a00; }
.row-danger { background: rgba(139,0,0,0.15); }
.cell-danger { color: #ff6b6b; }
.cell-ok { color: var(--green-bright); }

/* ── Stats ── */
.stats-page { max-width: 600px; margin: 0 auto; padding: 3rem 1.5rem; }
.stats-page h1 { font-size: 1.8rem; font-weight: 700; margin-bottom: 2rem; }
.stats-grid { display: flex; gap: 1.5rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.stat-card { flex: 1; min-width: 140px; border: 1px solid var(--border); border-radius: 8px; padding: 1.5rem; display: flex; flex-direction: column; gap: 0.4rem; }
.stat-number { font-size: 2.5rem; font-weight: 700; color: var(--green-bright); }
.stat-label { font-size: 0.85rem; color: var(--text-color); }
.stats-langs h2 { font-size: 1rem; margin-bottom: 1rem; }
.stats-langs ul { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.stats-langs li { font-size: 0.9rem; display: flex; align-items: center; gap: 0.6rem; }
.lang-tag { background: var(--green); color: #fff; padding: 0.1rem 0.5rem; border-radius: 3px; font-size: 0.75rem; font-weight: 500; }

/* ── Login ── */
.login-page { max-width: 380px; margin: 6rem auto; padding: 2rem 1.5rem; border: 1px solid var(--border); border-radius: 8px; }
.login-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 2rem; text-align: center; }
.login-form { display: flex; flex-direction: column; gap: 1.2rem; }

/* ── Superadmin ── */
.mod-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.btn-superadmin { background: transparent; border: 2px solid var(--green); color: #fff; padding: 0.4rem 1.1rem; border-radius: 4px; text-decoration: none; font-size: 0.85rem; }
/* Current admin page: filled pill so the active nav entry stands out. */
.btn-superadmin.active { background: var(--green); border-color: var(--green); color: #fff; font-weight: 500; }
.btn-logout { background: transparent; border: 2px solid var(--green); color: #fff; padding: 0.4rem 1.1rem; border-radius: 4px; font-size: 0.85rem; cursor: pointer; font-family: inherit; }
.mod-add-form { display: flex; gap: 0.8rem; flex-wrap: wrap; align-items: center; }
.mod-add-form input, .mod-add-form select { background: #111; border: 1px solid var(--border); color: #fff; padding: 0.5rem 0.8rem; border-radius: 4px; font-size: 0.85rem; }
.mod-add-form input:focus, .mod-add-form select:focus { outline: none; border-color: var(--green); }
.role-badge { padding: 0.15rem 0.5rem; border-radius: 3px; font-size: 0.75rem; font-weight: 500; }
.role-superadmin { background: #1a1a2e; color: #8888ff; border: 1px solid #4a4a8a; }
.role-moderator { background: #0d1f0d; color: var(--green-bright); border: 1px solid var(--green); }

/* Admin muted text lifted from the public #aaa to #c8c8c8 for legibility on
   the fixed black admin background. Scoped to body.admin so the public scope
   (:root / body.public) keeps #aaa. Covers helpers, descriptions and every
   inline color:var(--muted); principal field labels are bumped further to
   var(--fg) directly on their elements. */
body.admin { --muted: #c8c8c8; }

/* Admin links: fixed readable green, never the browser's purple :visited.
   Excludes the logo anchor and the .btn-superadmin pill, which carry their
   own styling. */
body.admin a:not(.logo):not(.btn-superadmin):not(.btn-visit),
body.admin a:not(.logo):not(.btn-superadmin):not(.btn-visit):visited {
    color: var(--green-bright);
    text-decoration: underline;
}
body.admin a:not(.logo):not(.btn-superadmin):not(.btn-visit):hover {
    color: var(--green-bright);
    text-decoration: none;
}

/* Outline neutral action button (the "Visit" link in /moderate rows). Sits
   between .btn-accept (green) and .btn-reject (red) as a discreet third look. */
.btn-visit {
    display: inline-flex;
    align-items: center;
    background: transparent;
    border: 1px solid var(--muted);
    color: var(--fg);
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.2;
}
.btn-visit:hover { border-color: var(--green); color: var(--green-bright); }
