/* Community by Mohit Public Styles */

/* Override external CSS that might interfere with Community Board elements */
.cbm-community-board select:not(.dokan-form-control) {
    height: auto !important;
    opacity: 1 !important;
    position: relative !important;
    display: block !important;
}

.cbm-community-board button:not(.dokan-form-control) {
    height: auto !important;
    opacity: 1 !important;
    position: relative !important;
    display: inline-block !important;
}

/* Override external CSS that might interfere with Community Board admin elements */
.wrap select:not(.dokan-form-control) {
    height: auto !important;
    opacity: 1 !important;
    position: relative !important;
    display: block !important;
}

.wrap button:not(.dokan-form-control) {
    height: auto !important;
    opacity: 1 !important;
    position: relative !important;
    display: inline-block !important;
}


.cbm-community-board {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Header */
.cbm-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
}

.cbm-header-content h2 {
    margin: 0 0 10px 0;
    font-size: 2.2em;
    font-weight: 700;
}

.cbm-header-content p {
    margin: 0;
    font-size: 1.1em;
    opacity: 0.9;
}

.cbm-header-actions {
    flex-shrink: 0;
}

.cbm-login-prompt {
    color: white;
    margin: 0;
}

.cbm-login-prompt a {
    color: white;
    text-decoration: underline;
    font-weight: 600;
}

/* Buttons */
.cbm-btn {
    display: inline-flex;
    align-items: center;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    gap: 8px;
}

.cbm-btn-primary {
    background: #fff;
    color: #667eea;
}

.cbm-btn-primary:hover {
    background: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.cbm-btn-secondary {
    background: #6c757d;
    color: white;
}

.cbm-btn-secondary:hover {
    background: #5a6268;
}

.cbm-icon {
    font-size: 16px;
}

/* Category Filter */
.cbm-category-filter {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.cbm-filter-section {
    margin-bottom: 15px;
}

.cbm-filter-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.cbm-category-select {
    width: 100% !important;
    max-width: 300px;
    padding: 10px 15px !important;
    border: 1px solid #ced4da !important;
    border-radius: 8px;
    background-color: white !important;
    font-size: 14px !important;
    color: #495057 !important;
    cursor: pointer;
    transition: border-color 0.2s ease;
    height: auto !important;
    opacity: 1 !important;
    position: relative !important;
    display: block !important;
}

.cbm-category-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cbm-category-select optgroup {
    font-weight: 600;
    color: #495057;
    padding: 8px 0;
}

.cbm-category-select option {
    padding: 8px;
    font-weight: normal;
}

/* Topic Category Select Override */
#cbm-topic-category {
    width: 100% !important;
    padding: 10px 15px !important;
    border: 1px solid #ced4da !important;
    border-radius: 8px;
    background-color: white !important;
    font-size: 14px !important;
    color: #495057 !important;
    cursor: pointer;
    height: auto !important;
    opacity: 1 !important;
    position: relative !important;
    display: block !important;
}

#cbm-topic-category:focus {
    outline: none;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
}

/* Quick Filter Buttons */
.cbm-quick-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cbm-quick-filter {
    background: white !important;
    border: 1px solid #ced4da !important;
    padding: 8px 16px !important;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px !important;
    font-weight: 500;
    color: #6c757d !important;
    transition: all 0.2s ease;
    white-space: nowrap;
    height: auto !important;
    opacity: 1 !important;
    position: relative !important;
    display: inline-block !important;
}

.cbm-quick-filter:hover {
    color: #495057;
    border-color: #adb5bd;
    background-color: #e9ecef;
}

.cbm-quick-filter.active {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
}

/* Topics */
.cbm-topics-container {
    position: relative;
}

.cbm-loading {
    text-align: center;
    padding: 40px;
    color: #6c757d;
}

.cbm-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cbm-topics-list {
    display: grid;
    gap: 20px;
}

.cbm-topic-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.cbm-topic-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

.cbm-topic-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    gap: 15px;
}

.cbm-topic-title {
    margin: 0;
    font-size: 1.3em;
    font-weight: 600;
    flex: 1;
}

.cbm-topic-link {
    color: #212529;
    text-decoration: none;
}

.cbm-topic-link:hover {
    color: #667eea;
}

.cbm-topic-category {
    background: #e9ecef;
    color: #495057;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    flex-shrink: 0;
}

.cbm-topic-content {
    color: #6c757d;
    line-height: 1.6;
    margin-bottom: 20px;
}

.cbm-topic-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.cbm-topic-author {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.cbm-avatar {
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.cbm-avatar img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.cbm-author-name {
    font-weight: 600;
    color: #495057;
}

.cbm-topic-date {
    color: #6c757d;
    font-size: 0.9em;
}

.cbm-topic-stats {
    display: flex;
    gap: 15px;
    align-items: center;
}

.cbm-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #6c757d;
    font-size: 0.9em;
}

.cbm-reaction-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6c757d;
    font-size: 0.9em;
}

.cbm-reaction-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8f9ff;
}

.cbm-reaction-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Empty State */
.cbm-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.cbm-empty-state h3 {
    margin-bottom: 15px;
    color: #495057;
}

/* Inline Forms */
.cbm-create-topic-section,
.cbm-topic-detail-section {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.cbm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e9ecef;
}

.cbm-section-header h3 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
    color: #212529;
}

.cbm-inline-form {
    max-width: none;
}

.cbm-form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.cbm-form-group-small {
    min-width: 200px;
}

.cbm-answer-form-section {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid #e9ecef;
}

.cbm-answer-form-section h4 {
    margin-bottom: 20px;
    color: #495057;
    font-size: 1.2em;
}

.cbm-login-prompt-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    text-align: center;
    color: #6c757d;
}

.cbm-login-prompt-section a {
    color: #667eea;
    font-weight: 600;
    text-decoration: none;
}

.cbm-login-prompt-section a:hover {
    text-decoration: underline;
}

/* Forms */
.cbm-form-group {
    margin-bottom: 20px;
}

.cbm-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.cbm-form-group input,
.cbm-form-group select,
.cbm-form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.cbm-form-group input:focus,
.cbm-form-group select:focus,
.cbm-form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cbm-form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.cbm-form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    margin-top: 20px;
}

/* Topic Detail */
.cbm-topic-detail {
    padding: 20px 0;
}

.cbm-topic-detail-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.cbm-topic-detail-title {
    font-size: 1.8em;
    font-weight: 700;
    color: #212529;
    margin-bottom: 15px;
    line-height: 1.3;
}

.cbm-topic-detail-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #6c757d;
    font-size: 0.9em;
    flex-wrap: wrap;
}

.cbm-topic-detail-category {
    background: #e9ecef;
    color: #495057;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

.cbm-topic-detail-content {
    line-height: 1.7;
    color: #495057;
    margin-bottom: 30px;
    font-size: 1.05em;
}

.cbm-topic-detail-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

.cbm-topic-detail-content p {
    margin-bottom: 16px;
}

.cbm-topic-detail-content h1,
.cbm-topic-detail-content h2,
.cbm-topic-detail-content h3,
.cbm-topic-detail-content h4,
.cbm-topic-detail-content h5,
.cbm-topic-detail-content h6 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: #212529;
}

.cbm-topic-detail-stats {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f1;
}

.cbm-answers-section {
    border-top: 2px solid #e9ecef;
    padding-top: 30px;
    margin-top: 30px;
}

.cbm-answers-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.cbm-answers-header h4 {
    margin: 0;
    font-size: 1.3em;
    color: #495057;
}

.cbm-answer {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 3px solid #667eea;
}

.cbm-answer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.cbm-answer-author {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cbm-answer-content {
    color: #495057;
    line-height: 1.6;
}

.cbm-answer-content p:last-child {
    margin-bottom: 0;
}

/* Pagination */
.cbm-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 40px;
}

.cbm-pagination button {
    padding: 8px 16px;
    border: 1px solid #e9ecef;
    background: white;
    color: #495057;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cbm-pagination button:hover {
    border-color: #667eea;
    color: #667eea;
}

.cbm-pagination button.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.cbm-pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .cbm-community-board {
        padding: 15px;
    }
    
    .cbm-header {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .cbm-header-content h2 {
        font-size: 1.8em;
    }
    
    .cbm-category-filter {
        padding: 15px;
    }
    
    .cbm-category-select {
        max-width: 100%;
    }
    
    .cbm-quick-filters {
        justify-content: center;
    }
    
    .cbm-topic-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cbm-topic-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .cbm-topic-stats {
        width: 100%;
        justify-content: flex-start;
    }
    
    .cbm-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .cbm-form-group-small {
        min-width: auto;
    }
    
    .cbm-form-actions {
        flex-direction: column;
    }
    
    .cbm-form-actions .cbm-btn {
        width: 100%;
        justify-content: center;
    }
    
    .cbm-section-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .cbm-topic-detail-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .cbm-topic-card {
        padding: 16px;
    }
    
    .cbm-topic-title {
        font-size: 1.1em;
    }
    
    .cbm-create-topic-section,
    .cbm-topic-detail-section {
        padding: 16px;
    }
}
