/* Variables pour les couleurs et les transitions */
:root {
    --primary-color: #0079d3;
    --primary-hover: #005fa3;
    --upvote-color: #ff4500;
    --downvote-color: #7193ff;
    --background-color: #f2f6f9;
    --card-background: #ffffff;
    --text-color: #1c1c1c;
    --text-secondary: #717171;
    --border-color: #e6e6e6;
    --transition-speed: 0.2s;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    --summary-background: #f9f9ff;
    --summary-border: #d4d4ff;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0;
}

/* Header styling */
header {
    background-color: white;
    box-shadow: var(--shadow);
    padding: 10px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

header h1 {
    margin: 0;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 24px;
    transition: color var(--transition-speed) ease;
}

header h1:hover {
    color: var(--primary-hover);
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 600px;
    margin: 0 20px;
}

.search-bar input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px 0 0 20px;
    font-size: 14px;
}

.search-bar button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 20px 20px 0;
    padding: 0 15px;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
}

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

.user-actions button {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    border-radius: 4px;
    color: var(--primary-color);
    padding: 6px 12px;
    margin-left: 10px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-login:hover {
    background-color: #f5f9ff;
}

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

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

.btn-logout {
    color: #d32f2f;
    border-color: #d32f2f;
}

.btn-logout:hover {
    background-color: #fff5f5;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Main content area */
main {
    padding: 20px;
    margin-bottom: 50px;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-content h2 {
    margin-top: 0;
    color: var(--text-color);
}

/* Form styling */
.form-group {
    margin-bottom: 20px;
}

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

.form-group input, 
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: border var(--transition-speed) ease;
}

.form-group input:focus, 
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 121, 211, 0.2);
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color var(--transition-speed) ease;
}

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

button:disabled {
    background-color: #a0c7e4;
    cursor: not-allowed;
}

button[type="button"] {
    background-color: #f5f5f5;
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

button[type="button"]:hover {
    background-color: #e9e9e9;
}

/* Communities list */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.btn-add {
    padding: 8px 12px;
    font-size: 14px;
}

.communities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.community-card {
    background-color: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    cursor: pointer;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.community-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}

.community-logo {
    color: var(--primary-color);
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 10px;
}

.community-content h3 {
    margin: 5px 0;
    color: var(--text-color);
}

.community-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

.community-stats {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Community view */
.community-header {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    box-shadow: var(--shadow);
}

.back-button {
    display: inline-flex;
    align-items: center;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 14px;
}

.back-button i {
    margin-right: 5px;
}

.community-info h2 {
    margin: 5px 0;
    color: var(--text-color);
}

.community-description {
    color: var(--text-secondary);
    margin-top: 10px;
    font-size: 14px;
}

.btn-add-post {
    align-self: flex-start;
    padding: 8px 16px;
    font-size: 14px;
}

/* Add post form */
.add-post-form {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.add-post-form h3 {
    margin-top: 0;
    color: var(--text-color);
}

/* Posts list */
.posts-controls {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.sort-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sort-controls button {
    background-color: #f5f5f5;
    color: var(--text-color);
    padding: 6px 12px;
    font-size: 14px;
}

.sort-controls button.active {
    background-color: var(--primary-color);
    color: white;
}

.post-card {
    background-color: var(--card-background);
    border-radius: 8px;
    margin-bottom: 15px;
    display: flex;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.post-votes {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background-color: #f9f9f9;
    padding: 10px;
    min-width: 40px;
}

.post-votes button {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px;
    transition: color var(--transition-speed) ease;
}

.post-votes button:hover {
    color: var(--text-color);
}

.post-votes button.voted {
    color: var(--upvote-color);
}

.post-votes button:nth-child(3).voted {
    color: var(--downvote-color);
}

.post-content {
    flex: 1;
    padding: 15px;
    cursor: pointer;
}

.post-metadata {
    display: flex;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    gap: 10px;
}

.post-title {
    margin: 5px 0;
    color: var(--text-color);
}

.post-text {
    color: var(--text-color);
    margin-bottom: 10px;
}

.post-footer {
    display: flex;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Post detail view */
.post-detail {
    background-color: var(--card-background);
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    box-shadow: var(--shadow);
}

.post-detail .post-content {
    padding: 20px;
}

.post-detail .post-title {
    font-size: 24px;
    margin-bottom: 15px;
}

.post-detail .post-text {
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

/* Comments section */
.add-comment-form {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.add-comment-form h3 {
    margin-top: 0;
    margin-bottom: 15px;
}

.add-comment-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 100px;
    margin-bottom: 15px;
}

.comments-section {
    background-color: var(--card-background);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.comments-section h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--text-color);
}

.comment-card {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
}

.comment-card:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.comment-votes {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 30px;
    margin-right: 10px;
}

.comment-content {
    flex: 1;
}

.comment-metadata {
    display: flex;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    gap: 10px;
}

.comment-text {
    margin-bottom: 10px;
}

.comment-actions {
    display: flex;
    gap: 8px;
    margin-top: 5px;
    flex-wrap: wrap;
}

.comment-actions .btn-reply,
.comment-actions .btn-summary {
    font-size: 11px;
    padding: 2px 6px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.comment-actions .btn-reply:hover,
.comment-actions .btn-summary:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.comment-actions .btn-summary.active {
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 3px;
}

.reply-form {
    margin-top: 10px;
    margin-bottom: 10px;
    margin-left: 20px;
}

.reply-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    min-height: 80px;
    margin-bottom: 10px;
}

.nested-comments {
    margin-left: 20px;
    margin-top: 15px;
    padding-left: 15px;
    border-left: 2px solid var(--border-color);
}

.comment-card.nested {
    border-bottom: none;
    padding-bottom: 10px;
    margin-bottom: 10px;
}

/* Search results */
.search-view h2 {
    margin-bottom: 20px;
}

.search-view h3 {
    margin: 20px 0 15px;
    color: var(--text-color);
}

.community-tag {
    display: inline-block;
    background-color: #f0f7ff;
    color: var(--primary-color);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    margin-bottom: 5px;
}

.no-results {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    font-style: italic;
}

/* Utility classes */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.no-posts, 
.no-comments {
    text-align: center;
    padding: 30px;
    color: var(--text-secondary);
    background-color: #f9f9f9;
    border-radius: 8px;
    margin-bottom: 20px;
}

.error {
    color: #d32f2f;
    margin-top: 10px;
    padding: 8px;
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
}

.success {
    color: #388e3c;
    margin-top: 10px;
    padding: 8px;
    background-color: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 4px;
}

footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--text-secondary);
    background-color: white;
}

[v-cloak] {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-bar {
        width: 100%;
        max-width: none;
        margin: 10px 0;
    }
    
    .communities-grid {
        grid-template-columns: 1fr;
    }
    
    .post-card {
        flex-direction: column;
    }
    
    .post-votes {
        flex-direction: row;
        padding: 5px;
        justify-content: center;
    }
    
    .community-header {
        padding: 15px;
    }
}

/* Styles pour les résumés */
.summary-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-summary {
    background-color: #f0f0f0;
    color: var(--text-secondary);
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
}

.btn-summary:hover {
    background-color: #e5e5e5;
    color: var(--text-color);
}

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

.summary-box {
    margin-top: 15px;
    padding: 15px;
    background-color: var(--summary-background);
    border: 1px solid var(--summary-border);
    border-radius: 8px;
}

.summary-box h4 {
    margin-top: 0;
    margin-bottom: 10px;
    color: var(--primary-color);
    font-size: 16px;
}

.summary-content {
    white-space: pre-line;
    line-height: 1.5;
    font-size: 14px;
}

.summary-empty {
    text-align: center;
    color: var(--text-secondary);
}

.btn-generate {
    background-color: var(--primary-color);
    color: white;
    padding: 8px 16px;
    font-size: 14px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color var(--transition-speed) ease;
    margin-top: 10px;
}

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

.btn-generate:disabled {
    background-color: #a0c7e4;
    cursor: not-allowed;
}