body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #18191a;
    color: #e4e6eb;
    margin: 0;
    line-height: 1.5;
}

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

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 10px;
    border-bottom: 1px solid #393a3b;
    margin-bottom: 20px;
}

.header-logo {
    height: 40px; /* Adjust height as needed for your logo */
    width: auto;
}

h2 {
    display: flex;
    align-items: center;
}

.refresh-btn {
    width: 20px;
    height: 20px;
    cursor: pointer;
    vertical-align: middle;
    margin-left: 10px;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.refresh-btn:hover {
    opacity: 1;
    transform: rotate(30deg);
}

button {
    background-color: #2d88ff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #4b9eff;
}

button:disabled {
    background-color: #4b4c4f;
    color: #9a9b9d;
    cursor: not-allowed;
}

.hidden {
    display: none;
}

#media-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.media-card {
    background-color: #242526;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.media-preview {
    width: 100%;
    height: 180px;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.media-preview img,
.media-preview video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-preview audio {
    width: 100%;
}

.media-info {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.media-info h3 {
    margin: 0 0 10px;
    font-size: 18px;
}

.media-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 10px;
}

.tag {
    background-color: #3a3b3c;
    color: #e4e6eb;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.uploader-info {
    margin-top: auto;
    padding-top: 10px;
}

.uploader-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #e4e6eb;
    font-weight: bold;
}

.uploader-link:hover {
    text-decoration: underline;
}

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

.media-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
    align-self: flex-start;
}

.card-btn {
    background-color: #3a3b3c;
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: bold;
}

.card-btn:hover {
    filter: brightness(1.2);
}

.feature-btn {
    background-color: #ffc107;
    color: black;
}

.unfeature-btn {
    background-color: #4b4c4f;
}

.view-btn {
    background-color: #2d88ff;
}

.delete-btn {
    background-color: #da3633;
    color: white;
    padding: 4px 8px;
    font-size: 12px;
    margin-top: 10px;
    align-self: flex-start;
}

.delete-btn:hover {
    background-color: #f85149;
}

.empty-state {
    text-align: center;
    padding: 50px 20px;
    background-color: #242526;
    border-radius: 8px;
    color: #8a8d91;
    font-size: 18px;
    grid-column: 1 / -1;
}

#recent-title {
    margin-top: 40px;
}

.search-container {
    margin-bottom: 20px;
}

#search-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #4b4c4f;
    border-radius: 6px;
    box-sizing: border-box;
    background-color: #3a3b3c;
    color: #e4e6eb;
    font-size: 16px;
}

#tag-filter-container {
    margin-bottom: 20px;
}

#tag-filter-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

#tag-filter-options .tag {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
}

#tag-filter-options .tag.selected {
    background-color: #2d88ff;
    color: white;
}

#featured-media-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
    overflow: hidden;
}

/* Featured tag specific style */
.tag.featured {
    background-color: #3a3b00; /* A darker, slightly yellowish-brown tint */
    color: #e4e600;
}

/* File View Page */
#file-view-page {
    background-color: #242526;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#back-to-discover-btn {
    margin-bottom: 20px;
    background-color: #4b4c4f;
}

.file-view-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

#file-view-media {
    height: 400px;
    border-radius: 8px;
    overflow: hidden;
}

#file-view-media iframe {
    width: 100%;
    height: 100%;
    border: none;
}

#file-view-info {
    position: relative;
}

#file-view-info h3 {
    margin-top: 0;
    font-size: 24px;
}

#file-view-info .media-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

#like-container, #download-container {
    margin-top: 20px;
}

#download-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

#download-btn:hover {
    background-color: #0056b3;
}

#like-btn {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: bold;
    color: #e4e6eb;
}

#like-btn img {
    width: 32px;
    height: 32px;
    transition: transform 0.2s;
}

#like-btn:hover img {
    transform: scale(1.1);
}

/* Comments Section */
#comment-section h3 {
    border-bottom: 1px solid #393a3b;
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#comment-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #4b4c4f;
    border-radius: 6px;
    box-sizing: border-box;
    background-color: #3a3b3c;
    color: #e4e6eb;
    margin-bottom: 10px;
    resize: vertical;
}

#comments-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comment-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.comment-item .uploader-avatar {
    width: 32px;
    height: 32px;
}

.comment-body {
    flex-grow: 1;
}

.comment-content {
    background-color: #3a3b3c;
    padding: 8px 12px;
    border-radius: 12px;
    word-wrap: break-word;
}

.comment-content p {
    margin: 0;
}

.comment-author {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 4px;
}
.comment-author a {
    color: #e4e6eb;
    text-decoration: none;
}
.comment-author a:hover {
    text-decoration: underline;
}

/* Form Styles */
#upload-page {
    background-color: #242526;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

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

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

.form-group input[type="file"],
.form-group input[type="text"],
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #4b4c4f;
    border-radius: 6px;
    box-sizing: border-box;
    background-color: #3a3b3c;
    color: #e4e6eb;
}

#ai-generate-section {
    border: 1px solid #393a3b;
    border-radius: 8px;
    padding: 15px;
    margin-top: 20px;
}

#ai-generate-section h4 {
    margin-top: 0;
}

#ai-preview-container {
    margin-bottom: 15px;
    height: 256px; /* A fixed height for the preview */
}

.tags-container {
    margin-top: 10px;
}

.tags-container h4 {
    margin: 0 0 5px;
    font-size: 14px;
}

.note {
    color: #8a8d91;
    font-size: 14px;
    margin: 0;
}

#automatic-tags-list .tag {
    display: inline-block;
}

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

#cancel-upload-btn {
    background-color: #4b4c4f;
    color: #e4e6eb;
}

#cancel-upload-btn:hover {
    background-color: #5d5e61;
}

/* Updated styles for selected tags */
.tag.selected {
    border: 1px solid white; /* White border for selected state */
    padding: 3px 8px; /* Keep padding consistent as .tag */
}

/* Hide original checkbox */
.hidden-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.manual-tag-option {
    display: inline-block; /* Fix: Prevent the tag from stretching */
    margin-right: 5px; /* Add some spacing between manual tags */
    margin-bottom: 5px; /* Add some spacing for wrapped tags */
}

.manual-tag-option.hidden {
    display: none;
}