:root {
    --color-primary: #2C5F8A;
    --color-primary-hover: #1f4565;
    --color-secondary: #6c757d;
    --color-background: #ffffff;
    --color-surface: #f8f9fa;
    --color-text: #212529;
    --color-text-muted: #6c757d;
    --color-border: #dee2e6;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-greentext: #789922;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.navbar {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-primary);
    text-decoration: none;
}

.board-links {
    display: flex;
    gap: 15px;
    overflow-x: auto;
}

.board-links a {
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 4px;
}

.board-links a:hover {
    background: var(--color-border);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-primary, .btn-secondary, .btn-danger {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 16px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

.boards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.board-card {
    background: var(--color-surface);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.board-card h2 {
    font-size: 20px;
    margin-bottom: 10px;
}

.board-card h2 a {
    color: var(--color-primary);
    text-decoration: none;
}

.board-description {
    color: var(--color-text-muted);
    margin-bottom: 15px;
}

.board-stats {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    color: var(--color-text-muted);
}

.thread-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
    margin-bottom: 10px;
    border-radius: 4px;
}

.thread-avatar img, .post-avatar img {
    border-radius: 50%;
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 64px; height: 64px; }

.thread-content h3 {
    font-size: 18px;
    margin-bottom: 5px;
}

.thread-content h3 a {
    color: var(--color-text);
    text-decoration: none;
}

.thread-meta, .post-info {
    font-size: 14px;
    color: var(--color-text-muted);
}

.separator {
    margin: 0 5px;
}

.premium-badge {
    color: #ffd700;
    font-size: 12px;
}

.post {
    background: var(--color-surface);
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.post-header {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.post-meta {
    flex: 1;
    display: flex;
    justify-content: space-between;
}

.post-content {
    line-height: 1.8;
}

.greentext {
    color: var(--color-greentext);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: var(--color-background);
    padding: 30px;
    border-radius: 8px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    cursor: pointer;
}

.alert {
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.auth-container {
    max-width: 500px;
    margin: 50px auto;
}

.auth-card {
    background: var(--color-surface);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
}

.auth-links {
    margin-top: 20px;
    text-align: center;
    display: flex;
    justify-content: space-between;
}

.user-menu {
    position: relative;
}

.user-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 1px solid var(--color-border);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    margin-top: 5px;
    min-width: 150px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: var(--color-text);
    text-decoration: none;
}

.dropdown-menu a:hover {
    background: var(--color-border);
}

.poll-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    color: var(--color-text-muted);
    font-size: 14px;
}

.typing-dots span {
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

.footer {
    background: var(--color-surface);
    padding: 20px;
    text-align: center;
    margin-top: 50px;
    border-top: 1px solid var(--color-border);
}

/* ─── Typing indicators ─────────────────────────────────────────── */
.typing-indicators {
    margin: 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.typing-indicators.visible {
    opacity: 1;
    pointer-events: auto;
}

.typing-entry {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--color-primary);
    border-radius: 4px;
    padding: 10px 14px;
    transition: opacity 0.2s ease, transform 0.2s ease;
    opacity: 0;
    transform: translateY(-4px);
}

.typing-entry.visible {
    opacity: 1;
    transform: translateY(0);
}

.typing-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--color-text-muted);
    margin-bottom: 5px;
}

.typing-name {
    font-weight: 600;
    color: var(--color-primary);
}

.typing-label {
    font-style: italic;
}

.typing-dots span {
    animation: typingPulse 1.2s infinite;
    opacity: 0.3;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingPulse {
    0%, 60%, 100% { opacity: 0.3; }
    30%           { opacity: 1; }
}

.typing-preview {
    font-size: 14px;
    color: var(--color-text);
    white-space: pre-wrap;
    word-break: break-word;
    overflow-y: visible;
    border-left: 2px solid var(--color-border);
    padding-left: 8px;
    margin-top: 4px;
}

/* ─── Reply form header ──────────────────────────────────────────── */
.reply-form-header {
    padding: 8px 0 10px;
    font-size: 13px;
    color: var(--color-text-muted);
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 12px;
}

.reply-form-header strong {
    color: var(--color-primary);
}

/* ─── Own post highlight ─────────────────────────────────────────── */
.post-own {
    border-left: 3px solid var(--color-primary) !important;
}

.own-badge {
    font-size: 11px;
    color: var(--color-primary);
    font-weight: 600;
    margin-left: 4px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
    }
    .boards-grid {
        grid-template-columns: 1fr;
    }
    .thread-item {
        flex-direction: column;
    }
}
