/**
 * meningR - Discourse-inspired Design
 * Version: 2.1.0
 */

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --color-primary: #0088cc;
    --color-primary-hover: #006699;
    --color-success: #25a35a;
    --color-bg: #f2f4f7;
    --color-surface: #ffffff;
    --color-surface-alt: #f8f9fa;
    --color-border: #e1e4e8;
    --color-border-light: #eef0f2;
    --color-text: #222222;
    --color-text-secondary: #5c6773;
    --color-text-muted: #919aa3;
    --color-link: #0088cc;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-hover: 0 2px 8px rgba(0,0,0,0.12);
    --radius: 4px;
    --radius-lg: 8px;
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

html {
    font-size: 15px;
}

body {
    font-family: var(--font-sans);
    line-height: 1.5;
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Container */
.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.forum-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 16px 0;
    margin-bottom: 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.forum-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.forum-header h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.5px;
}

.forum-header .tagline {
    color: var(--color-text-muted);
    font-size: 0.9rem;
    margin-left: 16px;
}

.forum-header .back-link {
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.forum-header .back-link:hover {
    color: var(--color-primary);
    text-decoration: none;
}

/* Avatar */
.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.avatar-sm {
    width: 28px;
    height: 28px;
    font-size: 0.7rem;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.avatar-lg {
    width: 48px;
    height: 48px;
    font-size: 1.1rem;
}

.avatar-xl {
    width: 100px;
    height: 100px;
    font-size: 2.2rem;
}

/* Thread List - Table Style */
.thread-list {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.thread-card {
    display: grid;
    grid-template-columns: 1fr 80px 140px;
    align-items: center;
    gap: 20px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--color-border-light);
    transition: background 0.15s;
}

.thread-card:last-child {
    border-bottom: none;
}

.thread-card:hover {
    background: var(--color-surface-alt);
}

.thread-main {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 0;
}

.thread-avatar .avatar {
    width: 40px;
    height: 40px;
    font-size: 0.9rem;
}

.thread-content {
    min-width: 0;
    flex: 1;
}

.thread-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.35;
}

.thread-title a {
    color: var(--color-text);
}

.thread-title a:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.thread-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.thread-meta .author a {
    color: var(--color-text-secondary);
}

.thread-meta .author a:hover {
    color: var(--color-primary);
}

.thread-meta .separator {
    margin: 0 2px;
    color: var(--color-border);
}

.thread-excerpt {
    display: none;
}

.thread-stats {
    text-align: center;
}

.thread-stats .stat-number {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-text);
    display: block;
}

.thread-stats .stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: lowercase;
}

.thread-activity {
    text-align: right;
    font-size: 0.85rem;
}

.latest-reply {
    color: var(--color-text-muted);
}

.latest-reply a {
    color: var(--color-text-secondary);
    font-weight: 500;
}

.latest-reply .latest-time {
    display: block;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

.latest-label {
    display: none;
}

/* Thread View */
.thread-view {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.thread-post {
    padding: 24px;
}

.post-header {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.post-avatar a {
    display: block;
}

.post-meta {
    flex: 1;
    min-width: 0;
}

.post-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.25;
    color: var(--color-text);
}

.post-author-info {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 4px;
}

.post-author {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 1rem;
}

.post-author:hover {
    text-decoration: underline;
}

.post-author-details {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.post-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.post-content {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text);
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border-light);
}

.post-content a {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Replies Section */
.replies-section {
    padding: 20px 24px 24px;
    background: var(--color-surface-alt);
    border-top: 3px solid var(--color-primary);
}

.replies-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.replies-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.reply {
    background: var(--color-surface);
    padding: 16px 18px;
    border-bottom: 1px solid var(--color-border-light);
}

.reply:first-child {
    border-radius: var(--radius) var(--radius) 0 0;
}

.reply:last-child {
    border-bottom: none;
    border-radius: 0 0 var(--radius) var(--radius);
}

.reply:only-child {
    border-radius: var(--radius);
}

.reply.depth-2 {
    margin-left: 40px;
    border-left: 3px solid var(--color-primary);
}

.reply.depth-3 {
    margin-left: 80px;
    border-left: 3px solid var(--color-success);
}

.reply.depth-4 {
    margin-left: 120px;
    border-left: 3px solid var(--color-text-muted);
}

.reply-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.reply-avatar .avatar {
    width: 32px;
    height: 32px;
    font-size: 0.75rem;
}

.reply-meta {
    flex: 1;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 6px;
}

.reply-author {
    font-weight: 600;
    color: var(--color-primary);
    font-size: 0.95rem;
}

.reply-info {
    color: var(--color-text-muted);
    font-size: 0.8rem;
}

.reply-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-left: auto;
}

.reply-content {
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--color-text);
    padding-left: 42px;
}

.reply-content a {
    color: var(--color-primary);
}

.reply-children {
    margin-top: 0;
}

/* Profile View */
.profile-view {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
}

.profile-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 24px;
    position: sticky;
    top: 90px;
}

.profile-header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--color-border-light);
}

.profile-avatar {
    margin-bottom: 14px;
}

.profile-name {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.profile-nickname {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.profile-profession {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.profile-details {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--color-text-muted);
}

.detail-value {
    color: var(--color-text);
    text-align: right;
    max-width: 60%;
}

.interest-tag {
    display: inline-block;
    background: var(--color-bg);
    color: var(--color-text-secondary);
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8rem;
    margin: 2px;
}

.profile-stats {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
}

.stat-box {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    background: var(--color-surface-alt);
    border-radius: var(--radius);
}

.stat-box .stat-number {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--color-primary);
    display: block;
}

.stat-box .stat-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
}

/* Activity Section */
.profile-activity {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 24px;
}

.profile-activity h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-list {
    display: flex;
    flex-direction: column;
}

.activity-item {
    display: flex;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--color-border-light);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: 700;
    flex-shrink: 0;
}

.activity-thread .activity-icon {
    background: var(--color-primary);
    color: white;
}

.activity-reply .activity-icon {
    background: var(--color-success);
    color: white;
}

.activity-content {
    flex: 1;
    min-width: 0;
}

.activity-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-bottom: 3px;
}

.activity-label a {
    color: var(--color-text-secondary);
}

.activity-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
    line-height: 1.3;
}

.activity-title a {
    color: var(--color-text);
}

.activity-title a:hover {
    color: var(--color-primary);
}

.activity-excerpt {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.5;
    margin-bottom: 4px;
}

.activity-date {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--color-text-muted);
}

/* Footer */
.forum-footer {
    text-align: center;
    padding: 24px 0;
    margin-top: 40px;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 900px) {
    .profile-view {
        grid-template-columns: 1fr;
    }

    .profile-card {
        position: static;
    }

    .reply.depth-2,
    .reply.depth-3,
    .reply.depth-4 {
        margin-left: 24px;
    }
}

@media (max-width: 768px) {
    html {
        font-size: 14px;
    }

    .container {
        padding: 0 16px;
    }

    .forum-header {
        padding: 12px 0;
    }

    .forum-header .tagline {
        display: none;
    }

    .thread-card {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 16px;
    }

    .thread-avatar {
        display: none;
    }

    .thread-main {
        gap: 0;
    }

    .thread-stats {
        display: inline-flex;
        gap: 4px;
        align-items: baseline;
    }

    .thread-stats .stat-number {
        font-size: 0.9rem;
    }

    .thread-stats .stat-label {
        font-size: 0.75rem;
    }

    .thread-activity {
        text-align: left;
        display: inline;
        margin-left: 12px;
    }

    .latest-reply .latest-time {
        display: inline;
    }

    .thread-post {
        padding: 16px;
    }

    .post-header {
        flex-direction: column;
        gap: 12px;
    }

    .post-avatar {
        display: none;
    }

    .post-title {
        font-size: 1.3rem;
    }

    .replies-section {
        padding: 16px;
    }

    .reply {
        padding: 12px 14px;
    }

    .reply-content {
        padding-left: 0;
    }

    .reply.depth-2,
    .reply.depth-3,
    .reply.depth-4 {
        margin-left: 16px;
    }

    .profile-header {
        flex-direction: column;
    }

    .detail-row {
        flex-direction: column;
        gap: 2px;
    }

    .detail-value {
        text-align: left;
        max-width: 100%;
    }
}


/* Login & Authentication Styles */
.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-left: auto;
}

.btn-header {
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 400;
    border: 1px solid var(--color-border-light);
    background: transparent;
    color: var(--color-text-secondary);
    transition: all 0.2s;
}

.btn-header:hover {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-header.btn-primary {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-header.btn-primary:hover {
    background: var(--color-primary-hover);
    border-color: var(--color-primary-hover);
}

/* New Thread Button */
.thread-actions {
    margin-bottom: 20px;
    text-align: right;
}

.btn-new-thread {
    display: inline-block;
    padding: 8px 16px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 400;
    transition: all 0.2s;
}

.btn-new-thread:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

/* Reply Actions */
.reply-action {
    margin: 30px 0;
    padding: 20px;
    background: var(--color-surface-alt);
    border-radius: var(--radius);
    text-align: center;
}

.btn-reply {
    display: inline-block;
    padding: 8px 18px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-light);
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 400;
    margin-right: 12px;
    transition: all 0.2s;
}

.btn-reply:hover {
    background: var(--color-surface-alt);
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.reply-notice {
    color: var(--color-text-muted);
    font-size: 14px;
}

.reply-actions {
    margin-top: 12px;
}

.btn-reply-inline {
    display: inline-block;
    padding: 3px 10px;
    color: var(--color-text-muted);
    border: none;
    border-radius: var(--radius);
    font-size: 12px;
    background: transparent;
    transition: all 0.2s;
}

.btn-reply-inline:hover {
    color: var(--color-text-secondary);
    background: var(--color-surface-alt);
}

/* Login/Register Forms */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border-light);
}

.card-body {
    padding: 32px;
}

.card-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--color-text);
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    font-size: 15px;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-text {
    display: block;
    margin-top: 4px;
    font-size: 13px;
}

.form-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.form-check-input {
    margin-top: 4px;
}

.form-check-label {
    font-size: 14px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-surface-alt);
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-primary:hover {
    background: var(--color-primary);
    color: white;
    border-color: var(--color-primary);
}

.btn-outline-secondary {
    background: white;
    color: var(--color-text);
    border-color: var(--color-border);
}

.btn-outline-secondary:hover {
    background: var(--color-surface-alt);
    border-color: var(--color-text-secondary);
}

.w-100 {
    width: 100%;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.alert-danger {
    background: #fee;
    border: 1px solid #fcc;
    color: #a00;
}

.alert-warning {
    background: #ffc;
    border: 1px solid #fc9;
    color: #850;
}

.shadow {
    box-shadow: var(--shadow-card);
}

.mt-5 { margin-top: 48px; }
.mt-4 { margin-top: 32px; }
.mt-3 { margin-top: 24px; }
.mt-2 { margin-top: 16px; }
.mb-4 { margin-bottom: 32px; }
.mb-3 { margin-bottom: 24px; }
.mb-0 { margin-bottom: 0; }
.my-4 { margin-top: 32px; margin-bottom: 32px; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-muted); }
.small { font-size: 13px; }
.justify-content-center { justify-content: center; }
.row { display: flex; flex-wrap: wrap; margin: 0 -12px; }
.col-md-6, .col-lg-5 { padding: 0 12px; }
.col-lg-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }

@media (max-width: 768px) {
    .col-md-6,
    .col-lg-5 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .header-right {
        margin-left: auto;
    }
}
