/* ================================
   CREATE TOPIC
================================ */

.topic-create {
    width: 100%;
    padding: 1.5rem;
    background-color: #8b5cf60f;
    border: 1px solid #8b5cf652;
    border-radius: 12px;
}

.community-create-description {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}


/* ================================
   FIELDS
================================ */

.topic-create-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.topic-create-field:last-of-type {
    margin-bottom: 0;
}

.topic-create-field>label {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 600;
}

.topic-create-field input,
.topic-create-field textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--bg-card);
    border-radius: 8px;
    color: var(--text-primary);
    font: inherit;
    outline: none;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.topic-create-field input {
    min-height: 48px;
}

.topic-create-field textarea {
    min-height: 220px;
    line-height: 1.6;
    resize: vertical;
}

.topic-create-field input:hover,
.topic-create-field textarea:hover {
    background: var(--bg-card);
}

.topic-create-field input:focus,
.topic-create-field textarea:focus {
    border-color: var(--accent-violet);
}

.topic-create-field input::placeholder,
.topic-create-field textarea::placeholder {
    color: var(--text-muted);
}


/* ================================
   CATEGORY DROPDOWN
================================ */

.topic-category-dropdown {
    position: relative;
    width: 100%;
}

.topic-category-trigger {
    width: 100%;
    min-height: 48px;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--bg-card);
    border-radius: 8px;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.topic-category-trigger:hover {
    background: var(--bg-card);
}

.topic-category-trigger:focus {
    outline: none;
    border-color: var(--accent-violet);
}

.topic-category-trigger[aria-expanded="true"] {
    background: var(--bg-card);
    border-color: var(--accent-violet);
    border-radius: 8px 8px 0 0;
}

#topicCategoryLabel {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.topic-category-arrow {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 1.1rem;
    transition: transform 0.2s ease;
}

.topic-category-trigger[aria-expanded="true"] .topic-category-arrow {
    transform: rotate(180deg);
}


/* ================================
   CATEGORY MENU
================================ */

.topic-category-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 510px;
    overflow-y: auto;
    background: var(--bg-secondary);
    border: 1px solid var(--accent-violet);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--accent-glow);
}

.topic-category-option {
    width: 100%;
    padding: 0.8rem 1rem;
    display: flex;
    align-items: center;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--bg-card);
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.topic-category-option:last-child {
    border-bottom: none;
}

.topic-category-option:hover {
    background: var(--bg-card);
    color: var(--accent-violet);
}

.topic-category-option.active {
    background: var(--bg-card);
    color: var(--accent-violet);
}


/* ================================
   ACTIONS
================================ */

.topic-create-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--bg-card);
}

.topic-create-cancel,
.topic-create-submit {
    min-height: 42px;
    padding: 0.65rem 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.topic-create-cancel {
    background: transparent;
    border: 1px solid var(--bg-card);
    color: var(--text-muted);
}

.topic-create-cancel:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.topic-create-submit {
    background: var(--accent-violet);
    border: 1px solid var(--accent-violet);
    color: var(--text-primary);
}

.topic-create-submit:hover {
    background: var(--accent-dark-violet);
    border-color: var(--accent-dark-violet);
}

.topic-create-submit:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}


/* ================================
   SCROLLBAR
================================ */

.topic-category-menu {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-dark-violet) transparent;
}

.topic-category-menu::-webkit-scrollbar {
    width: 6px;
}

.topic-category-menu::-webkit-scrollbar-track {
    background: transparent;
}

.topic-category-menu::-webkit-scrollbar-thumb {
    background: var(--accent-dark-violet);
    border-radius: 10px;
}

.topic-category-group-title {
    padding: 15px 15px 0;
    color: var(--accent-dark-violet);
    font-weight: bold;
    font-size: 20px;
}

/* ================================
   IMAGE UPLOAD
================================ */

.topic-image-upload {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

.topic-image-upload-btn {
    min-height: 42px;
    padding: 0.65rem 1rem;
    flex-shrink: 0;
    background: var(--bg-primary);
    border: 1px solid var(--bg-card);
    border-radius: 7px;
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

.topic-image-upload-btn:hover {
    background: var(--bg-card);
    border-color: var(--accent-violet);
}

.topic-image-upload-btn:focus {
    outline: none;
    border-color: var(--accent-violet);
}

.topic-image-upload-info {
    color: var(--text-muted);
    font-size: 0.8rem;
}


/* ================================
   SELECTED IMAGES
================================ */

.topic-image-files {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.topic-image-files:empty {
    display: none;
}

.topic-image-file {
    min-height: 38px;
    padding: 0.55rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--bg-card);
    border-radius: 7px;
}

.topic-image-file-name {
    min-width: 0;
    overflow: hidden;
    color: var(--text-primary);
    font-size: 0.82rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.topic-image-file-remove {
    padding: 0;
    flex-shrink: 0;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font: inherit;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease;
}

.topic-image-file-remove:hover {
    color: var(--accent-pink);
}

/* ================================
   MOBILE
================================ */

@media (max-width: 768px) {

    .topic-create {
        padding: 1rem;
    }

    .topic-create-field textarea {
        min-height: 180px;
    }

    .topic-create-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .topic-create-cancel,
    .topic-create-submit {
        width: 100%;
    }

    .topic-image-upload {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .topic-image-upload-btn {
        width: 100%;
    }

    .topic-image-upload-info {
        line-height: 1.4;
    }
}