/* ------------------------------------------------------------------
   Flat File Forum — minimalist, modern, clean stylesheet
   ------------------------------------------------------------------ */

:root {
    --bg: #f7f8fa;
    --surface: #ffffff;
    --border: #e3e6ea;
    --text: #1c2126;
    --text-muted: #6b7280;
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --danger: #dc2626;
    --danger-dark: #b91c1c;
    --success-bg: #ecfdf3;
    --success-text: #15803d;
    --error-bg: #fef2f2;
    --error-text: #b91c1c;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

h1, h2, h3 {
    font-weight: 600;
    line-height: 1.25;
    margin: 0 0 12px;
}
h1 { font-size: 26px; }
h2 { font-size: 19px; margin-top: 28px; }

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

code {
    background: #eef0f3;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.9em;
}

.container {
    max-width: 760px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 20px;
}
.brand {
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
}
.brand:hover { text-decoration: none; }
.nav {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 14px;
    flex-wrap: wrap;
}
.nav-user { color: var(--text-muted); }

main { padding: 28px 20px 60px; }

/* Alerts / flash messages */
.alert {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
}
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-error   { background: var(--error-bg);   color: var(--error-text); }

/* Topic list */
.topic-list {
    list-style: none;
    margin: 20px 0 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.topic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
}
.topic-row:last-child { border-bottom: none; }
.topic-title {
    font-weight: 600;
    color: var(--text);
    font-size: 16px;
}
.topic-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
.topic-replies {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}
.empty-state {
    color: var(--text-muted);
    padding: 24px 0;
}

/* Topic / post detail */
.topic-op, .post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.post-list { list-style: none; margin: 0; padding: 0; }
.post-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.post-content {
    white-space: pre-wrap;
    word-break: break-word;
}
.post-actions {
    margin-top: 12px;
    display: flex;
    gap: 14px;
    font-size: 13px;
}
.badge {
    display: inline-block;
    background: #e0e7ff;
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
    border-radius: 20px;
    margin-left: 4px;
}

/* Forms */
.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.form-card h3 { margin-top: 0; }

label {
    font-weight: 600;
    font-size: 14px;
    margin-top: 4px;
}
.hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 13px;
}

input[type=text],
input[type=password],
textarea,
select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 15px;
    background: #fff;
    color: var(--text);
}
textarea { resize: vertical; min-height: 120px; }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.inline-form { display: inline; }

.button, button.button {
    align-self: flex-start;
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.button:hover { background: var(--accent-dark); text-decoration: none; }
.button.danger { background: var(--danger); }
.button.danger:hover { background: var(--danger-dark); }

.link-button {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}
.link-button:hover { text-decoration: underline; }
.link-button.danger { color: var(--danger); }

/* Auth pages */
.auth-box {
    max-width: 380px;
    margin: 20px auto 0;
}
.auth-box h1 { text-align: center; }

/* Admin user table */
.user-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 14px;
}
.user-table th, .user-table td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}
.user-table th {
    background: #fafbfc;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.user-table tr:last-child td { border-bottom: none; }
.user-table td form { display: inline; margin-left: 8px; }

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px 0 40px;
}

/* Responsive */
@media (max-width: 560px) {
    .header-inner { flex-direction: column; align-items: flex-start; }
    .topic-row { flex-direction: column; align-items: flex-start; gap: 4px; }
    .user-table { font-size: 13px; }
}
