
/* Estafette Web Client — style.css */
:root {
    --bg: #1a1b26;
    --bg-alt: #24283b;
    --fg: #c0caf5;
    --fg-muted: #565f89;
    --accent: #7aa2f7;
    --border: #3b4261;
    --ok: #9ece6a;
    --warn: #e0af68;
    --err: #f7768e;
    --radius: 6px;
    --gap: 16px;
}

/* Light theme */
@media (prefers-color-scheme: light) {
    :root {
        --bg: #f5f5f5;
        --bg-alt: #ffffff;
        --fg: #1a1b26;
        --fg-muted: #6b7280;
        --accent: #2563eb;
        --border: #d1d5db;
        --ok: #16a34a;
        --warn: #d97706;
        --err: #dc2626;
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--fg);
    min-height: 100vh;
    line-height: 1.5;
}

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

/* Header */
.header {
    background: var(--bg-alt);
    border-bottom: 1px solid var(--border);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: var(--gap);
    position: sticky;
    top: 0;
    z-index: 100;
}
.brand { font-weight: 700; font-size: 18px; color: var(--accent); }
.search-form { flex: 1; max-width: 400px; }
.search-input {
    width: 100%;
    padding: 6px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 14px;
}
.user-menu { display: flex; align-items: center; gap: 12px; }
.bell { font-size: 16px; }
.dropdown { position: relative; cursor: pointer; }
.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 150px;
    z-index: 200;
}
.dropdown:hover .dropdown-content { display: block; }
.dropdown-content a, .dropdown-content button {
    display: block;
    padding: 8px 16px;
    color: var(--fg);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
}
.dropdown-content a:hover, .dropdown-content button:hover { background: var(--bg); }

/* Layout */
.layout {
    display: flex;
    max-width: 1800px;
    margin: 0 auto;
    min-height: calc(100vh - 120px);
}
.sidebar {
    width: 340px;
    flex-shrink: 0;
    border-right: 1px solid var(--border);
    padding: var(--gap);
    background: var(--bg-alt);
}
.main {
    flex: 1;
    padding: var(--gap) 24px;
    max-width: 1100px;
}

/* Sidebar */
.sidebar-section { margin-bottom: 20px; }
.sidebar-section h3 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--fg-muted);
    margin-bottom: 8px;
}
.sidebar-link {
    display: block;
    padding: 4px 8px;
    font-size: 13px;
    color: var(--fg);
    border-radius: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-link:hover { background: var(--bg); text-decoration: none; }
.sidebar-link.bold { font-weight: 600; }
.sidebar-link.muted { color: var(--fg-muted); font-size: 12px; margin-top: 4px; }
.badge {
    display: inline-block;
    background: var(--accent);
    color: var(--bg);
    border-radius: 10px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 4px;
}

/* Thread list */
.sort-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--gap);
}
.sort-tabs a {
    padding: 8px 16px;
    color: var(--fg-muted);
    border-bottom: 2px solid transparent;
    font-size: 13px;
}
.sort-tabs a.active, .sort-tabs a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
    text-decoration: none;
}
.thread-list { }
.thread-row {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}
.thread-row.unread .thread-subject { font-weight: 600; }
.thread-subject { display: block; font-size: 15px; margin-bottom: 4px; }
.thread-meta { display: flex; gap: 12px; font-size: 12px; color: var(--fg-muted); }
.thread-author { color: var(--accent); }
.thread-replies { color: var(--fg-muted); }
.thread-sf128 { color: var(--fg-muted); font-size: 11px; font-family: monospace; }

/* Messages */
.thread-view { }
.message {
    padding: 16px;
    margin-bottom: 12px;
    border-radius: var(--radius);
}
.message-header { display: flex; gap: 12px; margin-bottom: 8px; }
.message-from { font-weight: 600; color: var(--accent); }
.message-date { color: var(--fg-muted); font-size: 12px; }
.message-body { line-height: 1.6; }
.message-body p { margin-bottom: 8px; }
.message-body code {
    background: var(--bg);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 13px;
}
.message-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    font-size: 12px;
}
.message-actions a, .btn-link {
    color: var(--fg-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
}
.message-actions a:hover, .btn-link:hover { color: var(--accent); }

/* Timeline / Posts */
.timeline { }
.post {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.post-header { display: flex; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.post-author { font-weight: 600; color: var(--accent); }
.post-date { color: var(--fg-muted); font-size: 12px; }
.post-sf128 { color: var(--fg-muted); font-size: 11px; font-family: monospace; }
.post-body { line-height: 1.6; margin-bottom: 8px; }
.post-tags { margin-bottom: 8px; }
.tag { color: var(--accent); font-size: 13px; margin-right: 8px; }
.post-actions { display: flex; gap: 12px; font-size: 12px; }

/* Direct messages */
.direct-inbox { }
.conversation-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border);
    color: var(--fg);
}
.conversation-row:hover { background: var(--bg-alt); text-decoration: none; }
.conversation-row.unread { font-weight: 600; }
.conv-name { flex-shrink: 0; width: 100px; }
.conv-sigil { color: var(--fg-muted); font-size: 12px; flex-shrink: 0; width: 140px; }
.conv-snippet { flex: 1; color: var(--fg-muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { color: var(--fg-muted); font-size: 12px; flex-shrink: 0; }

.conversation { max-height: 500px; overflow-y: auto; padding: var(--gap); }
.dm { max-width: 70%; padding: 10px 14px; border-radius: 12px; margin-bottom: 8px; }
.dm.own { margin-left: auto; background: var(--accent); color: var(--bg); }
.dm.other { background: var(--bg-alt); border: 1px solid var(--border); }
.dm-meta { font-size: 11px; opacity: 0.7; margin-top: 4px; }
.dm-compose {
    display: flex;
    gap: 8px;
    padding: var(--gap);
    border-top: 1px solid var(--border);
}
.dm-compose textarea { flex: 1; }

/* Compose */
.compose-form { max-width: 700px; }
.compose-box {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: var(--gap);
}
.compose-box textarea { width: 100%; margin-bottom: 8px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: var(--fg-muted); margin-bottom: 4px; }
.form-group label:has(input[type="radio"]) { display: inline-block; margin-right: 16px; color: var(--fg); }
.input {
    width: 100%;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--fg);
    font-size: 14px;
}
.textarea { font-family: inherit; resize: vertical; min-height: 120px; }
.form-actions { display: flex; gap: 8px; }
.preview {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px;
    margin-top: 8px;
}

/* Search */
.search-page { }
.search-bar { margin-bottom: var(--gap); }
.search-input-lg { font-size: 16px; padding: 10px 16px; }
.search-tabs {
    display: flex;
    gap: 0;
    margin-top: 8px;
    border-bottom: 1px solid var(--border);
}
.search-tabs a {
    padding: 6px 12px;
    color: var(--fg-muted);
    font-size: 13px;
    border-bottom: 2px solid transparent;
}
.search-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Notifications */
.notifications { }
.notif-actions { margin-bottom: var(--gap); }
.notif-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    color: var(--fg);
}
.notif-row.unread { font-weight: 600; }
.notif-row:hover { text-decoration: none; }
.notif-type { font-size: 11px; font-weight: 600; text-transform: uppercase; padding: 2px 6px; border-radius: 3px; }
.badge-reply { background: rgba(122, 162, 247, 0.2); color: var(--accent); }
.badge-direct { background: rgba(158, 206, 106, 0.2); color: var(--ok); }
.badge-boost { background: rgba(224, 175, 104, 0.2); color: var(--warn); }
.badge-moderation { background: rgba(247, 118, 142, 0.2); color: var(--err); }
.notif-text { flex: 1; font-size: 14px; }
.notif-age { color: var(--fg-muted); font-size: 12px; flex-shrink: 0; }

/* Profile */
.profile { max-width: 600px; }
.profile-header { margin-bottom: 20px; }
.profile-header h2 { font-size: 22px; }
.profile-address { color: var(--fg-muted); }
.profile-sigil { color: var(--accent); }
.profile-sf128 { color: var(--fg-muted); font-size: 12px; cursor: pointer; }
.profile-bio { margin: 12px 0; line-height: 1.5; }
.profile-website a { color: var(--accent); }
.profile-geo { color: var(--fg-muted); }
.profile-joined { color: var(--fg-muted); font-size: 13px; }
.profile-identity { background: var(--bg-alt); padding: 12px; border-radius: var(--radius); margin: 12px 0; }
.profile-identity code { font-family: monospace; }
.profile-actions { display: flex; gap: 8px; margin-top: 16px; }

/* Settings */
.settings { }
.settings-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--gap);
    flex-wrap: wrap;
}
.settings-tabs a {
    padding: 8px 14px;
    color: var(--fg-muted);
    font-size: 13px;
    border-bottom: 2px solid transparent;
}
.settings-tabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Groups directory */
.groups-directory { }
.groups-search { margin-bottom: var(--gap); }
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.table th, .table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.table th { color: var(--accent); font-weight: 600; font-size: 12px; text-transform: uppercase; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 6px 14px;
    background: var(--accent);
    color: var(--bg);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    text-decoration: none;
}
.btn:hover { opacity: 0.85; text-decoration: none; }
.btn-primary { background: var(--accent); }
.btn-secondary { background: var(--border); color: var(--fg); }
.btn-danger { background: var(--err); }
.btn-sm { padding: 3px 8px; font-size: 12px; }

/* Public banner */
.public-banner {
    background: rgba(224, 175, 104, 0.15);
    color: var(--warn);
    padding: 8px 24px;
    text-align: center;
    font-size: 13px;
}

/* Footer */
.footer {
    border-top: 1px solid var(--border);
    padding: 12px 24px;
    text-align: center;
    color: var(--fg-muted);
    font-size: 12px;
}

/* Login */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
.login-card {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    text-align: center;
    max-width: 400px;
    width: 100%;
}
.login-card h1 { color: var(--accent); font-size: 28px; margin-bottom: 8px; }
.subtitle { color: var(--fg-muted); margin-bottom: 24px; }
.notice { color: var(--warn); margin-bottom: 16px; }
.login-alt { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }

/* Error */
.error-box {
    background: rgba(247, 118, 142, 0.15);
    color: var(--err);
    padding: 12px;
    border-radius: var(--radius);
    margin-bottom: var(--gap);
}

/* Pagination */
.pagination { display: flex; gap: 8px; margin-top: var(--gap); justify-content: center; }

/* Compose button (floating on mobile) */
.compose-btn { }

/* Mobile (<768px) */
@media (max-width: 768px) {
    .sidebar { display: none; position: fixed; left: 0; top: 56px; bottom: 0; z-index: 90; width: 280px; }
    .sidebar.open { display: block; }
    .layout { flex-direction: column; }
    .main { padding: var(--gap); }
    .compose-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        z-index: 80;
    }
    .header { padding: 8px 12px; }
    .search-form { max-width: 200px; }
}
