/* ============================================
   MESSAGE ATTACHMENTS - Discord Style
   ============================================ */

/* Container for all attachments in a message */
.message-attachments {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 100%;
}

/* NUCLEAR OVERRIDE - Force ALL attachment images to be rectangular */
.message-attachments img,
.message-attachment img,
.message-attachment-image,
.message-image-container img,
#messages img:not(.avatar-img):not(.emoji) {
    max-width: 320px !important;
    max-height: 240px !important;
    min-width: 120px !important;
    min-height: 80px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px !important;
    cursor: pointer !important;
    object-fit: contain !important;
    display: block !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    background: linear-gradient(135deg, #2a2d35 0%, #1e2028 100%) !important;
}

/* ============================================
   IMAGE ATTACHMENTS - Thumbnail Style
   ============================================ */

.message-attachment-image {
    max-width: 320px !important;
    max-height: 240px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px;
    cursor: pointer;
    object-fit: contain;
    display: block;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.message-attachment-image:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Image container with placeholder */
.message-image-container {
    position: relative;
    min-width: 200px;
    min-height: 120px;
    max-width: 320px;
    background: linear-gradient(135deg, #2a2d35 0%, #1e2028 100%);
    border-radius: 8px;
    overflow: hidden;
    display: inline-block;
}

.message-image-container .image-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #72767d;
    font-size: 14px;
}

.message-image-container.image-broken .image-placeholder {
    display: flex;
}

.placeholder-icon {
    font-size: 32px;
    margin-bottom: 8px;
    opacity: 0.6;
}

.placeholder-text {
    font-size: 12px;
    opacity: 0.8;
}

/* Responsive: Mobile devices */
@media (max-width: 768px) {
    .message-attachment-image {
        max-width: 280px !important;
        max-height: 250px !important;
    }
}

@media (max-width: 480px) {
    .message-attachment-image {
        max-width: 100% !important;
        max-height: 220px !important;
    }
}

/* ============================================
   VIDEO ATTACHMENTS
   ============================================ */

.message-attachment-video {
    max-width: 400px !important;
    max-height: 300px !important;
    width: auto !important;
    height: auto !important;
    border-radius: 8px;
    display: block;
    background: #000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.message-attachment-video::-webkit-media-controls-panel {
    background: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.6));
}

@media (max-width: 768px) {
    .message-attachment-video {
        max-width: 100% !important;
        max-height: 280px !important;
    }
}

/* ============================================
   FILE ATTACHMENTS (PDF, ZIP, etc.)
   ============================================ */

.message-attachment-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(79, 84, 92, 0.16);
    border-radius: 4px;
    max-width: 400px;
    transition: background 0.2s ease;
}

.message-attachment-file:hover {
    background: rgba(79, 84, 92, 0.24);
}

.message-attachment-file-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.message-attachment-file-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.message-attachment-file-name {
    font-size: 14px;
    font-weight: 500;
    color: #dcddde;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-attachment-file-size {
    font-size: 12px;
    color: #96989d;
    margin-top: 2px;
}

.message-attachment-file-download {
    font-size: 20px;
    color: #b9bbbe;
    text-decoration: none;
    flex-shrink: 0;
    padding: 4px 8px;
    border-radius: 3px;
    transition: all 0.2s ease;
}

.message-attachment-file-download:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

/* ============================================
   LIGHTBOX SUPPORT
   ============================================ */

.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox-image {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}