:root {
    --primary: #9846a8;
    --primary-light: #b363c4;
    --primary-dark: #7a3189;
    --secondary: #0bc2cf;
    --secondary-light: #2ee6f4;
    --secondary-dark: #079aa6;
    --bg-dark: #2f2f2f;
    --bg-light: #f5f5f5;
    --text-dark: #333333;
    --text-light: #ffffff;
    --error: #e74c3c;
    --gray-shadow: rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: 'Nunito', sans-serif;
    background-color: #e0e0e0;
    color: var(--text-dark);
}

.main-content {
    padding: 20px;
    min-height: 100%;
    box-sizing: border-box;
}

/* Keep the permanent navigation usable even when upstream mobile styles hide it. */
#sidebar {
    position: fixed;
    top: 0;
    height: 100dvh;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start !important;
}

#sidebar .Sidebar_list__ljw79 {
    display: flex !important;
    flex-direction: column;
    flex: 0 0 auto;
    margin-top: 24px;
    padding: 0;
    width: 100%;
}

#sidebar .Sidebar_link__pbkfx {
    display: flex !important;
    align-items: center;
    min-height: 44px;
}

#sidebar .Sidebar_listIcon__rg5X6 {
    display: inline-flex !important;
    width: 26px;
    height: 26px;
    align-items: center;
    justify-content: center;
}

#sidebar .Sidebar_listIcon__rg5X6 svg {
    width: 24px;
    height: 24px;
}

#media-app .tabs {
    height: auto;
    max-height: none;
    overflow-y: hidden;
}

#media-app .tab {
    flex-shrink: 0;
}

.media-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.media-title {
    font-family: 'Titan One', cursive;
    font-size: 2.5rem;
    color: var(--primary);
    text-shadow: 2px 2px var(--gray-shadow);
    margin: 0;
}

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

.btn {
    font-family: 'Titan One', cursive;
    background-color: var(--secondary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 4px 0 var(--secondary-dark);
    transition: transform 0.1s, box-shadow 0.1s;
    text-decoration: none;
}

.btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0 0 var(--secondary-dark);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    box-shadow: 0 4px 0 rgba(0,0,0,0.1);
}

.btn-primary {
    background-color: var(--primary);
    box-shadow: 0 4px 0 var(--primary-dark);
}

.btn-primary:active:not(:disabled) {
    box-shadow: 0 0 0 var(--primary-dark);
}

.btn-danger {
    background-color: var(--error);
    box-shadow: 0 4px 0 #c0392b;
}

.btn-danger:active:not(:disabled) {
    box-shadow: 0 0 0 #c0392b;
}

.btn-icon {
    padding: 8px 12px;
}

.tabs {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    border-bottom: 3px solid #ccc;
    overflow-x: auto;
}

.tab {
    font-family: 'Titan One', cursive;
    font-size: 1.2rem;
    color: #888;
    background: none;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 4px solid transparent;
    margin-bottom: -3px;
    white-space: nowrap;
}

.tab.active {
    color: var(--primary);
    border-bottom: 4px solid var(--primary);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    padding: 10px 15px;
    border-radius: 20px;
    border: 2px solid #ccc;
    font-size: 1rem;
    width: 200px;
    outline: none;
}

.search-input:focus {
    border-color: var(--secondary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 5px 15px var(--gray-shadow);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.search-result-item {
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 700;
}

.search-result-item:hover {
    background-color: #f0f0f0;
}

/* Post Cards */
.feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding-bottom: 40px;
}

.post-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 4px 10px var(--gray-shadow);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.post-title {
    font-family: 'Titan One', cursive;
    font-size: 1.5rem;
    color: var(--text-dark);
    margin: 0;
}

.post-meta {
    font-size: 0.9rem;
    color: #666;
    margin-top: 5px;
}

.post-author {
    font-weight: 700;
    color: var(--primary);
    cursor: pointer;
}

.post-badges {
    display: flex;
    gap: 5px;
}

.badge {
    background: var(--bg-dark);
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 10px;
    text-transform: uppercase;
}

.badge-private {
    background: var(--error);
}

.post-body {
    font-size: 1.05rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.post-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.post-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: cover;
    box-shadow: 0 2px 5px var(--gray-shadow);
}

.post-actions {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.action-btn {
    background: none;
    border: none;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.2s;
}

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

.action-btn.active {
    color: var(--primary);
}

.owner-actions {
    margin-left: auto;
    display: flex;
    gap: 10px;
}

/* Comments Section */
.comments-section {
    margin-top: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    padding: 15px;
    display: none;
}

.comment {
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
}

.comment:last-child {
    border-bottom: none;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 5px;
}

.comment-author {
    font-weight: bold;
    color: var(--text-dark);
}

.comment-body {
    font-size: 0.95rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.comment-delete {
    color: var(--error);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: bold;
}

.comment-input-container {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.comment-input {
    flex: 1;
    font-family: 'Nunito', sans-serif;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: vertical;
    min-height: 40px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.modal {
    background: white;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-family: 'Titan One', cursive;
    font-size: 1.5rem;
    color: var(--primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-label {
    font-weight: 700;
    color: var(--text-dark);
}

.form-input, .form-textarea, .form-select {
    font-family: 'Nunito', sans-serif;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--secondary);
}

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

.modal-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Image Upload Preview */
.image-upload-area {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s;
}

.image-upload-area:hover {
    background: #f9f9f9;
}

.upload-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.upload-preview-item {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #ddd;
}

.upload-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255,0,0,0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 12px;
}

.info-text {
    font-size: 0.85rem;
    color: #666;
}

.loader {
    text-align: center;
    padding: 20px;
    font-weight: 700;
    color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
    font-size: 1.2rem;
    font-weight: bold;
}
