main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
    gap: 20px;
    position: relative;
    flex: 1;
    padding-bottom: 20px;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#news-list {
    width: 50%;
    margin: 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.post-input-section {
    margin-bottom: 40px;
     z-index: 100; 
}

.page-title {
    font-size: 2rem;
    margin: 0 0 20px 0;
    color: white;
}

.post-input {
    background: none;
}

.delete {
    display: flex;
    justify-content: flex-end;
    padding: 5px;
}

.delete-btn {
    background: transparent;
    color: white;
    border: none;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.delete-btn:hover {
    transform: scale(1.5);
}
.delete-btn:active{
    transform: scale(1.2);
}
.post-title {
    width: 70%;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: var(--bg);
    color: var(--bg-h1-colour);
    font-size: 1.2rem;
    margin-bottom: 12px;
    box-sizing: border-box;
}

.news-title {
    color: var(--bg-h1-colour);
    font-size: 2rem;
    font-weight: bolder;
    text-decoration: underline;
}

.newsfeedInput {
    flex: 1;
    padding: 12px 16px 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    min-height: 0px;
    line-height: 1.4;
    resize: vertical;
    box-sizing: border-box;
    background: var(--bg);
    color: var(--bg-h1-colour);
    width: 100%;
}

.comment-section {
    width: 100%;
    margin: 0 auto 20px;
}

.input-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    margin: 0 auto;
}

.newsfeedInput {
    padding: 12px 120px 12px 16px;
    border: 1px solid #1c1c1c;
    border-radius: 8px;
    font-size: 1rem;
    min-height: 60px;
    resize: vertical;
    box-sizing: border-box;
    background: var(--bg);
    color: var(--bg-h1-colour);
}

.attachments {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.news-attachment {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    object-fit: cover;
}

.news-attachment:last-child {
    margin-bottom: 0;
}

.input-buttons {
    position: absolute;
    bottom: 8px;
    right: 8px;
    display: flex;
    gap: 8px;
}

.attach-btn,
.send-btn {
    height: 36px;
    padding: 0 12px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attach-btn {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    width: 36px;
}

.attach-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.send-btn {
    background: #007bff;
    color: white;
}

.send-btn:hover {
    background: #0056b3;
}


.send-btn:hover {
    background: #242424;
}

.news-item {
    background: var(--bg);
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    padding: 24px;
    margin-bottom: 20px;
    max-width: 100%;
    box-sizing: border-box;
    font-family: "Fjalla One", sans-serif;
}


.news-date {
    color: #ffffff;
    font-size: 0.9rem;
    margin-bottom: 16px;
    font-weight: 400;
}

.news-body {
    color: #e0e0e0;
    line-height: 1.7;
    font-size: 1rem;
}

.post-content {
    line-height: 1.7;
}

.post-link {
    color: #4fc3f7;
    text-decoration: none;
}

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

.input-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 12px;
}

.attachments-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    justify-content: center;
    cursor: pointer;
}
.attachments-grid:hover{
     transform: scale(1.2);
}
.youtube-thumbnail {
    position: relative;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
}

.youtube-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    opacity: 0;
    transition: opacity 0.3s;
}

.youtube-thumbnail:hover .youtube-overlay {
    opacity: 1;
}

.media-lightbox.hidden {
  display: none;
}

.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
}

.media-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-lightbox-content img,
.media-lightbox-content video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
  box-shadow: 0 0 30px rgba(0,0,0,0.6);
}

.media-lightbox-close {
  position: absolute;
  top: -32px;
  right: -32px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: #00ff9d;
  color: #000;
  font-size: 20px;
  cursor: pointer;
}

.attachment-item {
    flex: 1 1 200px;
    max-width: 300px;
}

.news-attachment {
    width: 100%;
    height: 200px;
    object-fit: cover;
    /* Perfect crop, no distortion */
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.news-attachment-link {
    display: block;
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    text-decoration: none;
    color: #495057;
    font-size: 14px;
}

.media-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-preview img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.media-preview video {
    width: 80px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
}

.close-preview {
    margin-left: auto;
    color: #ff5555;
    font-size: 18px;
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 85, 85, 0.3);
    flex-shrink: 0;
}


.close-preview:hover {
    background: rgba(255, 0, 0, 1);
}

.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 22.5%;
    /* Small 16:9 */
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    display: block;
    margin: 8px 0;
}

.post-content {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.post-content .video-container {
    flex: 1 1 280px;
    /* Grow but max ~280px each */
    min-width: 250px;
    /* Minimum size */
    max-width: 800px;
    /* Maximum size */
    margin: 0;
    /* Remove individual margins */
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 12px;
}

@media (max-width: 500px) {
    #news-list {
        width: 100%;
    }

    .comment-section {
        width: 100%;
    }
}

@media (max-width: 900px) {
    #news-list {
        width: 100%;
    }

    .comment-section {
        width: 100%;
    }
}