/* ================================================
   DISCUSSION FORUM STYLES
   Shared styles for discussion.html and discussion-topic.html
   ================================================ */

/* ================================================
   Navigation Buttons (matching main page style)
   ================================================ */
.nav-btn.deadlines-btn,
.nav-btn.wiki-btn,
.nav-btn.discussion-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 100px;
    height: 36px;
    padding: 0 14px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    background: var(--primary-bg);
    color: var(--primary);
    border: 1px solid var(--primary-light);
}

.nav-btn.deadlines-btn:hover,
.nav-btn.wiki-btn:hover,
.nav-btn.discussion-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Help Button (Guide link) */
.nav-btn.help-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: var(--bg-gray);
    color: var(--text-muted);
    border: 1px solid var(--border-light, var(--border));
    border-radius: 50%;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.nav-btn.help-btn:hover {
    background: var(--primary-bg);
    color: var(--primary);
    border-color: var(--primary-light);
}

/* ================================================
   Page Layout
   ================================================ */
.discussion-page-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 20px;
}

/* ================================================
   Header Section
   ================================================ */
.discussion-header {
    text-align: center;
    margin-bottom: 32px;
}

.discussion-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 0 0 8px 0;
}

.discussion-title .title-icon {
    color: var(--primary);
    flex-shrink: 0;
}

.discussion-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

/* ================================================
   Search and Sort Controls
   ================================================ */
.discussion-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.discussion-search-bar {
    flex: 1;
    min-width: 200px;
    position: relative;
    display: flex;
    align-items: center;
}

.discussion-search-bar .search-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}

.discussion-search-input {
    width: 100%;
    padding: 10px 40px 10px 40px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all 0.2s;
}

.discussion-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.discussion-search-input::placeholder {
    color: var(--text-muted);
}

.discussion-search-bar .clear-search-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.discussion-search-bar .clear-search-btn:hover {
    color: var(--text-primary);
    background: var(--bg-gray);
}

.discussion-sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.sort-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.discussion-sort-select {
    padding: 8px 32px 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s;
}

.discussion-sort-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

/* ================================================
   Topics Container
   ================================================ */
.topics-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Loading State */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p {
    font-size: 14px;
    margin: 0;
}

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

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state-text {
    font-size: 15px;
    margin: 0;
}

/* ================================================
   Topic Card
   ================================================ */
.topic-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 20px 24px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
}

.topic-card:hover {
    border-color: var(--primary-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.topic-card:active {
    transform: translateY(0);
}

.topic-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.topic-name {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.4;
}

.topic-stats {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.topic-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.topic-stat svg {
    flex-shrink: 0;
}

.topic-summary {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.5;
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.topic-tag {
    padding: 2px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

/* Noscript fallback */
.topic-card-static {
    padding: 16px;
    margin-bottom: 12px;
}

.topic-card-static h2 {
    margin: 0 0 4px 0;
    font-size: 18px;
}

.topic-card-static a {
    color: var(--primary);
    text-decoration: none;
}

.topic-card-static p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ================================================
   Topic Detail Page - Header
   ================================================ */
.topic-detail-header {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.topic-detail-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.topic-detail-meta {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.topic-detail-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.topic-detail-stat svg {
    flex-shrink: 0;
}

.topic-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.topic-detail-description {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 16px 0;
}

.add-post-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.add-post-btn:hover {
    background: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

.add-post-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.add-post-btn svg {
    flex-shrink: 0;
}

/* Login prompt */
.login-prompt {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
}

.login-prompt a {
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
}

/* ================================================
   Posts Controls (Topic Detail)
   ================================================ */
.posts-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.posts-search-bar {
    flex: 1;
    min-width: 180px;
    position: relative;
    display: flex;
    align-items: center;
}

.posts-search-bar .search-icon {
    position: absolute;
    left: 10px;
    color: var(--text-muted);
    pointer-events: none;
}

.posts-search-input {
    width: 100%;
    padding: 8px 36px 8px 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text-primary);
    transition: all 0.2s;
}

.posts-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.posts-search-input::placeholder {
    color: var(--text-muted);
}

.posts-search-bar .clear-posts-search-btn {
    position: absolute;
    right: 6px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.posts-search-bar .clear-posts-search-btn:hover {
    color: var(--text-primary);
    background: var(--bg-gray);
}

.posts-sort-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.posts-sort-select {
    padding: 6px 28px 6px 10px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%236B7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: all 0.2s;
}

.posts-sort-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* ================================================
   Post Card
   ================================================ */
.posts-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.post-card {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-light);
}

.post-card:first-child {
    padding-top: 0;
}

.post-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

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

.post-author-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.post-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.post-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 12px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Markdown content in posts */
.post-body h1, .post-body h2, .post-body h3 {
    color: var(--text-primary);
    margin: 16px 0 8px 0;
}

.post-body h1 { font-size: 1.3em; }
.post-body h2 { font-size: 1.15em; }
.post-body h3 { font-size: 1.05em; }

.post-body strong { font-weight: 600; color: var(--text-primary); }

.post-body code {
    background: var(--bg-gray);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Consolas', 'Monaco', monospace;
}

.post-body pre {
    background: #1e1e1e;
    color: #d4d4d4;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.5;
    margin: 12px 0;
}

.post-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.post-body blockquote {
    border-left: 3px solid var(--primary-light);
    padding-left: 12px;
    margin: 12px 0;
    color: var(--text-secondary);
    font-style: italic;
}

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

.post-body ul, .post-body ol {
    padding-left: 24px;
    margin: 8px 0;
}

.post-body li {
    margin-bottom: 4px;
}

.post-body .math-inline {
    padding: 0 2px;
}

.post-body .math-block {
    display: block;
    text-align: center;
    margin: 12px 0;
    overflow-x: auto;
}

.post-body .math-block .katex-display {
    margin: 0;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.post-tag {
    padding: 2px 10px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 500;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ================================================
   Like Button
   ================================================ */
.like-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
}

.like-btn:hover {
    border-color: #FCA5A5;
    color: #DC2626;
    background: #FEF2F2;
}

.like-btn.liked {
    color: #DC2626;
    border-color: #FCA5A5;
    background: #FEF2F2;
}

.like-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.like-btn svg {
    flex-shrink: 0;
}

.like-count {
    font-weight: 500;
}

/* ================================================
   Reply Button
   ================================================ */
.reply-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
}

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

.reply-btn svg {
    flex-shrink: 0;
}

.reply-count {
    font-weight: 500;
}

/* ================================================
   Replies Section
   ================================================ */
.replies-section {
    margin-top: 16px;
    padding-top: 12px;
}

.reply-node {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: var(--bg-gray);
    border-radius: var(--radius-sm);
}

.reply-node.depth-1 {
    margin-left: 24px;
    border-left: 3px solid var(--primary-light);
}

.reply-node.depth-2 {
    margin-left: 48px;
    border-left: 3px solid #A78BFA;
}

.reply-node.depth-3 {
    margin-left: 48px;
    border-left: 3px solid var(--border);
}

.reply-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.reply-author-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.reply-author-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

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

.reply-body {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.reply-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 8px;
}

.reply-tag {
    padding: 1px 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 500;
}

.reply-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reply-like-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: none;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-family: inherit;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    min-height: 26px;
}

.reply-like-btn:hover {
    border-color: #FCA5A5;
    color: #DC2626;
}

.reply-like-btn.liked {
    color: #DC2626;
    border-color: #FCA5A5;
    background: #FEF2F2;
}

.reply-reply-btn {
    font-size: 12px;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.reply-reply-btn:hover {
    color: var(--primary);
    background: var(--primary-bg);
}

/* ================================================
   Reply Form (Inline)
   ================================================ */
.reply-form {
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-white);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
}

.reply-form-textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.2s;
    box-sizing: border-box;
}

.reply-form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.reply-form-tags {
    margin-top: 8px;
}

.reply-form-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 10px;
    gap: 8px;
}

.reply-form-word-count {
    font-size: 12px;
    color: var(--text-muted);
}

.reply-form-word-count.error {
    color: #DC2626;
}

.reply-form-buttons {
    display: flex;
    gap: 8px;
}

.reply-submit-btn {
    padding: 6px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.reply-submit-btn:hover {
    background: var(--primary-dark);
}

.reply-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reply-cancel-btn {
    padding: 6px 16px;
    background: var(--bg-gray);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.reply-cancel-btn:hover {
    background: var(--border-light);
}

/* ================================================
   Create Post Modal
   ================================================ */
.create-post-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: flex-start;
    overflow-y: auto;
    padding: 40px 20px;
}

.create-post-overlay.show {
    display: flex;
}

.create-post-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 720px;
    width: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.create-post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.create-post-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.create-post-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px 8px;
    transition: all 0.2s;
    line-height: 1;
}

.create-post-close-btn:hover {
    color: var(--text-primary);
}

.create-post-body {
    padding: 24px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.form-group {
    margin-bottom: 20px;
}

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

.form-label .required {
    color: #DC2626;
    margin-left: 2px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-white);
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-textarea {
    width: 100%;
    min-height: 200px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    resize: vertical;
    transition: all 0.2s;
    line-height: 1.6;
    box-sizing: border-box;
}

.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-error {
    font-size: 12px;
    color: #DC2626;
    margin-top: 4px;
    display: none;
}

.form-error.show {
    display: block;
}

.word-count-indicator {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    text-align: right;
}

.word-count-indicator.insufficient {
    color: #DC2626;
}

.word-count-indicator.sufficient {
    color: #059669;
}

/* Tag Input */
.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    min-height: 40px;
    align-items: center;
    background: var(--bg-white);
    transition: all 0.2s;
    cursor: text;
}

.tag-input-container:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-bg);
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--primary-bg);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 500;
}

.tag-pill-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--primary);
    padding: 0 2px;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.tag-pill-remove:hover {
    opacity: 1;
}

.tag-text-input {
    border: none;
    outline: none;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
    flex: 1;
    min-width: 100px;
    padding: 2px 0;
}

.tag-text-input::placeholder {
    color: var(--text-muted);
}

.tag-suggestions {
    position: relative;
}

.tag-suggestions-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    max-height: 150px;
    overflow-y: auto;
    z-index: 10;
    display: none;
}

.tag-suggestions-list.show {
    display: block;
}

.tag-suggestion-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.1s;
}

.tag-suggestion-item:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

/* Draft Indicator */
.draft-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #D97706;
    font-style: italic;
    padding: 6px 12px;
    background: #FFFBEB;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
}

.draft-indicator svg {
    flex-shrink: 0;
}

/* Create Post Footer */
.create-post-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    gap: 12px;
}

.save-draft-btn {
    padding: 8px 16px;
    background: var(--bg-gray);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.save-draft-btn:hover {
    background: var(--border-light);
}

.submit-post-btn {
    padding: 8px 24px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.submit-post-btn:hover {
    background: var(--primary-dark);
}

.submit-post-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================
   Load More Button
   ================================================ */
.load-more-container {
    text-align: center;
    padding: 24px 0;
}

.load-more-btn {
    padding: 10px 32px;
    background: var(--bg-white);
    color: var(--primary);
    border: 1.5px solid var(--primary-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
}

.load-more-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ================================================
   Toast Notification
   ================================================ */
.discussion-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    background: #1F2937;
    color: white;
    border-radius: var(--radius-sm);
    font-size: 14px;
    z-index: 10000;
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-lg);
}

.discussion-toast.show {
    transform: translateX(-50%) translateY(0);
}

.discussion-toast.success {
    background: #059669;
}

.discussion-toast.error {
    background: #DC2626;
}

/* ================================================
   Validation Error
   ================================================ */
.validation-message {
    font-size: 13px;
    color: #DC2626;
    padding: 8px 12px;
    background: #FEF2F2;
    border: 1px solid #FCA5A5;
    border-radius: var(--radius-sm);
    margin-top: 8px;
    display: none;
}

.validation-message.show {
    display: block;
}

/* ================================================
   No Posts State
   ================================================ */
.no-posts-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.no-posts-icon {
    width: 48px;
    height: 48px;
    color: var(--border);
    margin: 0 auto 12px;
}

.no-posts-text {
    font-size: 15px;
    margin: 0 0 4px 0;
}

.no-posts-hint {
    font-size: 13px;
    margin: 0;
}

/* ================================================
   Responsive Design
   ================================================ */
@media (max-width: 768px) {
    .discussion-page-content {
        padding: 16px 16px;
    }

    .discussion-title {
        font-size: 1.5rem;
    }

    .discussion-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .discussion-sort-controls {
        justify-content: flex-end;
    }

    .topic-card {
        padding: 16px;
    }

    .topic-name {
        font-size: 16px;
    }

    .topic-card-header {
        flex-direction: column;
        gap: 6px;
    }

    .topic-stats {
        order: -1;
    }

    .topic-detail-title {
        font-size: 1.4rem;
    }

    .topic-detail-meta {
        gap: 12px;
    }

    .posts-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .post-card {
        padding: 16px 0;
    }

    .post-actions {
        gap: 10px;
    }

    .create-post-overlay {
        padding: 20px 12px;
    }

    .create-post-card {
        max-width: 100%;
    }

    .create-post-body {
        padding: 16px;
    }

    .create-post-footer {
        flex-direction: column;
    }

    .submit-post-btn {
        width: 100%;
    }

    .save-draft-btn {
        width: 100%;
    }

    .reply-node.depth-1 {
        margin-left: 12px;
    }

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

@media (max-width: 480px) {
    .discussion-title {
        font-size: 1.25rem;
        gap: 8px;
    }

    .discussion-title .title-icon {
        width: 24px;
        height: 24px;
    }

    .topic-summary {
        white-space: normal;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
    }

    .post-title {
        font-size: 15px;
    }

    .like-btn, .reply-btn {
        padding: 4px 10px;
        font-size: 12px;
        min-height: 28px;
    }

    .create-post-header {
        padding: 16px;
    }

    .form-textarea {
        min-height: 150px;
    }
}

/* ================================================
   Create Topic - Slug Preview
   ================================================ */
#slugPreview {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    color: var(--primary);
    font-weight: 500;
}

.create-topic-btn {
    margin-top: 16px;
}

/* ================================================
   Edit Tags (Topic Creator)
   ================================================ */
.edit-tags-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px 6px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
    vertical-align: middle;
    margin-left: 6px;
}

.edit-tags-btn:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    background: var(--primary-bg);
}

.topic-edit-tags {
    margin: 8px 0;
}

.topic-edit-tags-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    justify-content: flex-end;
}
