body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: #f4f4f4;
    color: #333;
}

.container {
    width: 80%;
    margin: 20px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.header {
    background: #333;
    color: #fff;
    padding: 1rem 0;
    text-align: center;
}

.header h1 {
    margin: 0;
}

.nav {
    display: flex;
    justify-content: center;
    padding: 10px 0;
    background: #eee;
    border-bottom: 1px solid #ddd;
}

.nav a {
    color: #333;
    text-decoration: none;
    padding: 5px 15px;
}

.nav a:hover {
    background: #ddd;
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="url"],
.form-group textarea,
.form-group select {
    width: calc(100% - 20px);
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

button {
    background: #007bff;
    color: #fff;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
}

button:hover {
    background: #0056b3;
}

.alert {
    padding: 10px;
    margin-bottom: 15px;
    border-radius: 4px;
    border: 1px solid;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

/* Project List */
.project-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.project-card {
    background: #f9f9f9;
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.project-card h2 {
    margin-top: 0;
    font-size: 1.5rem;
}

.project-card a {
    text-decoration: none;
    color: #007bff;
}

.project-card a:hover {
    text-decoration: underline;
}

.project-thumbnail {
    max-width: 100%;
    height: auto;
    display: block;
    margin-bottom: 10px;
    border-radius: 4px;
}

.project-meta {
    font-size: 0.9em;
    color: #666;
}

.project-description {
    font-size: 0.95em;
    color: #555;
    margin-bottom: 15px;
}

.project-votes {
    font-size: 1.1em;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
}

.project-votes button {
    background: #f0f0f0;
    color: #333;
    border: 1px solid #ccc;
    padding: 5px 10px;
    margin-left: 10px;
    border-radius: 4px;
    cursor: pointer;
}

.project-votes button:hover:not(:disabled) {
    background: #e0e0e0;
}

.project-votes button.voted {
    background: #007bff;
    color: #fff;
    border-color: #007bff;
}

.project-votes button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}


/* Project Detail Page */
.project-detail-page .project-info {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.project-display-image {
    max-width: 100%;
    height: auto;
    margin-bottom: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.project-description-full {
    background: #f9f9f9;
    padding: 15px;
    border-left: 5px solid #007bff;
    margin-bottom: 20px;
    overflow-wrap: break-word; /* Ensure long words break */
}

.comments-section h2 {
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.comment-item {
    background: #fafafa;
    border: 1px solid #eee;
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 6px;
}

.comment-item .comment-meta {
    font-size: 0.85em;
    color: #777;
    margin-bottom: 5px;
}

.comment-item .comment-text {
    margin-top: 0;
}

.login-prompt {
    padding: 10px;
    background-color: #fff3cd;
    border: 1px solid #ffeeba;
    color: #856404;
    border-radius: 4px;
}

/* Pagination */
.pagination {
    margin-top: 20px;
    text-align: center;
}

.pagination a {
    display: inline-block;
    padding: 8px 12px;
    margin: 0 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-decoration: none;
    color: #007bff;
}

.pagination a.active {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.pagination a:hover:not(.active) {
    background-color: #eee;
}

/* Filters and Sort */
.filters-sort {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f8ff;
    border: 1px solid #e0efff;
    border-radius: 8px;
    align-items: flex-end; /* Align filter button to bottom */
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    flex-grow: 1;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 5px;
    font-weight: bold;
}

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

.sort-options a {
    text-decoration: none;
    color: #007bff;
    padding: 5px 10px;
    border-radius: 4px;
}

.sort-options a.active {
    background-color: #007bff;
    color: white;
}

.sort-options a:hover {
    background-color: #eee;
}

/* Tags in forms and detail pages */
.tag-cloud .tag-item {
    display: inline-block;
    background-color: #e2e6ea;
    color: #333;
    padding: 4px 8px;
    margin: 3px;
    border-radius: 3px;
    font-size: 0.85em;
    cursor: pointer;
}

.tag-cloud .tag-item:hover {
    background-color: #d6d8db;
}

.tag {
    display: inline-block;
    background-color: #007bff;
    color: white;
    padding: 4px 8px;
    margin: 3px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* TinyMCE specific styles (if needed) */
.tox-tinymce {
    border: 1px solid #ddd !important;
    border-radius: 4px;
}

/* Dark Mode (from dark_mode.js) */
body.dark-mode {
    background: #222;
    color: #eee;
}

body.dark-mode .container {
    background: #333;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

body.dark-mode .header {
    background: #111;
}

body.dark-mode .nav {
    background: #444;
    border-bottom-color: #555;
}

body.dark-mode .nav a {
    color: #eee;
}

body.dark-mode .nav a:hover {
    background: #555;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea,
body.dark-mode .form-group select {
    background: #444;
    color: #eee;
    border-color: #555;
}

body.dark-mode button {
    background: #0056b3;
}

body.dark-mode button:hover {
    background: #003f8c;
}

body.dark-mode .project-card {
    background: #444;
    border-color: #555;
    box-shadow: 0 2px 4px rgba(255,255,255,0.05);
}

body.dark-mode .project-card a {
    color: #79b3ff;
}

body.dark-mode .project-card a:hover {
    color: #a0d1ff;
}

body.dark-mode .project-meta {
    color: #bbb;
}

body.dark-mode .project-description {
    color: #ccc;
}

body.dark-mode .project-votes {
    color: #eee;
}

body.dark-mode .project-votes button {
    background: #555;
    color: #eee;
    border-color: #666;
}

body.dark-mode .project-votes button:hover:not(:disabled) {
    background: #666;
}

body.dark-mode .project-votes button.voted {
    background: #0056b3;
    border-color: #0056b3;
}

body.dark-mode .project-detail-page .project-info {
    border-bottom-color: #444;
}

body.dark-mode .project-description-full {
    background: #444;
    border-left-color: #0056b3;
}

body.dark-mode .comments-section h2 {
    border-bottom-color: #444;
}

body.dark-mode .comment-item {
    background: #4a4a4a;
    border-color: #555;
}

body.dark-mode .comment-item .comment-meta {
    color: #ccc;
}

body.dark-mode .comment-item .comment-text {
    color: #ddd;
}

body.dark-mode .pagination a {
    border-color: #555;
    color: #79b3ff;
}

body.dark-mode .pagination a.active {
    background-color: #0056b3;
    border-color: #0056b3;
}

body.dark-mode .pagination a:hover:not(.active) {
    background-color: #555;
}

body.dark-mode .filters-sort {
    background: #444;
    border-color: #555;
}

body.dark-mode .tag-cloud .tag-item {
    background-color: #555;
    color: #eee;
}

body.dark-mode .tag-cloud .tag-item:hover {
    background-color: #666;
}

body.dark-mode .tag {
    background-color: #0056b3;
}