/* Index Page Styles */
:root {
    --primary: #3b82f6;
    --primary-foreground: #ffffff;
    --background: #ffffff;
    --foreground: #020817;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --border: #e2e8f0;
    --accent: #f1f5f9;
}

[data-theme="dark"] {
    --primary: #3b82f6;
    --primary-foreground: #ffffff;
    --background: #020817;
    --foreground: #ffffff;
    --muted: #1e293b;
    --muted-foreground: #94a3b8;
    --border: #1e293b;
    --accent: #1e293b;
}

.forum-container {
    width: 100%;
    max-width: none;
    padding: 0;
}

.topics-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.topic-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: var(--background);
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s;
    width: 100%;
}

.topic-card:hover {
    background-color: var(--accent);
}

.topic-main {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex: 1;
}

.topic-info {
    flex: 1;
}

.topic-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--foreground);
}

.topic-info p {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.topic-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.stat {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat svg {
    width: 1rem;
    height: 1rem;
}

.search-and-new-topic {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    margin-bottom: 1.5rem;
    width: 100%;
}

.search-container {
    position: relative;
    flex: 1;
    margin-bottom: 0;
    min-width: 0; /* Prevents flex item from overflowing */
}

.search-input {
    width: 100%;
    height: 44px;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: var(--background);
    color: var(--foreground);
    font-size: 0.875rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-button {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0.25rem;
    color: var(--muted-foreground);
    cursor: pointer;
    transition: color 0.2s;
}

.search-button:hover {
    color: var(--primary);
}

.new-post-index-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
    height: 44px;
    white-space: nowrap;
    min-width: fit-content;
}

.new-post-index-button:hover {
    opacity: 0.9;
}

.new-post-index-button svg {
    width: 1.25rem;
    height: 1.25rem;
}

@media (max-width: 768px) {
    .search-and-new-topic {
        flex-direction: column-reverse;
        width: 100%;
    }

    .search-container,
    .new-post-index-button {
        width: 100%;
        max-width: 100%;
    }

    .search-input {
        width: 100%;
    }

    .new-post-index-button {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .topic-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .topic-stats {
        width: 100%;
        justify-content: space-between;
    }
}

/* Mobile Menu Styles */
.mobile-menu-button {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--foreground);
    margin-right: 1rem;
}

.mobile-menu-button svg {
    width: 24px;
    height: 24px;
}

.mobile-menu {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background-color: var(--background);
    z-index: 1000;
    transition: left 0.3s ease;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
}

.mobile-menu.open {
    left: 0;
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
}

.mobile-menu-overlay.open {
    display: block;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.mobile-menu-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
}

.close-menu {
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--foreground);
}

.mobile-menu-content {
    padding: 1rem;
}

.mobile-menu-content .sidebar-button {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    background-color: var(--background);
    color: var(--foreground);
    cursor: pointer;
    transition: background-color 0.2s;
}

.mobile-menu-content .sidebar-button:hover,
.mobile-menu-content .sidebar-button.active {
    background-color: var(--accent);
}

@media (max-width: 768px) {
    .mobile-menu-button {
        display: block;
        order: -1;
    }

    .sidebar-container {
        display: none;
    }
}

/* New Post Button and Form Styles */
.new-post-form {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 800px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 1.5rem;
    z-index: 1000;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.new-post-form-title {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    color: var(--foreground);
    background: var(--background);
}

.new-post-form select.postform {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    color: var(--foreground);
    background: var(--background);
    cursor: pointer;
}

.new-post-form textarea {
    width: 100%;
    min-height: 200px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-size: 1rem;
    color: var(--foreground);
    background: var(--background);
    resize: vertical;
}

.editor-toolbar {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 0;
}

.editor-toolbar .dashicons {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 0.25rem;
    cursor: pointer;
    color: var(--muted-foreground);
    transition: all 0.2s;
}

.editor-toolbar .dashicons:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--accent);
}

.editor-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    cursor: pointer;
    color: var(--muted-foreground);
    transition: color 0.2s;
}

.editor-close:hover {
    color: var(--primary);
}

.editor-mention {
    font-weight: bold;
    font-size: 1.2rem;
}

.form-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.form-submit {
    margin-top: 1rem;
    text-align: right;
}

.form-submit .submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    background-color: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

.form-submit .submit:hover {
    background-color: var(--primary-hover, #2563eb);
}

.sidebar-container {
    background-color: var(--background);
    border-radius: 0.5rem;
    padding: 0 1rem 1rem;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    margin-top: 0;
}

@media (max-width: 768px) {
    .new-post-form {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .editor-toolbar {
        justify-content: center;
    }
}
