/**
 * Attachment and File Upload Styles
 */

/* File upload area styling */
.file-upload-area {
    border: 2px dashed #4b5563;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    background: #374151;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.file-upload-area:hover {
    border-color: #6b7280;
    background: #4b5563;
}

.file-upload-area.dragover {
    border-color: #3b82f6;
    background: #1e3a8a;
    border-style: solid;
}

.file-upload-area.dragover::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(59, 130, 246, 0.1);
    pointer-events: none;
}

/* File list styling */
#fileList {
    max-height: 200px;
    overflow-y: auto;
}

#fileList::-webkit-scrollbar {
    width: 6px;
}

#fileList::-webkit-scrollbar-track {
    background: #374151;
    border-radius: 3px;
}

#fileList::-webkit-scrollbar-thumb {
    background: #6b7280;
    border-radius: 3px;
}

#fileList::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Attachment modal styles */
#attachmentModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

#attachmentModal.show {
    display: flex;
}

/* Attachment content area */
#attachmentContent {
    background: #1f2937;
    border-radius: 8px;
}

#attachmentContent img,
#attachmentContent video {
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

#attachmentContent iframe {
    border: none;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

#attachmentContent pre {
    background: #111827;
    border-radius: 8px;
    border: 1px solid #374151;
    overflow: auto;
    max-height: calc(90vh - 200px);
}

#attachmentContent pre::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

#attachmentContent pre::-webkit-scrollbar-track {
    background: #111827;
}

#attachmentContent pre::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

#attachmentContent pre::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Attachment list item animations */
.attachment-item {
    transition: all 0.2s ease;
}

.attachment-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* File type icons */
.file-icon {
    font-size: 24px;
    margin-right: 8px;
    display: inline-block;
    min-width: 32px;
    text-align: center;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #attachmentModal .bg-gray-900 {
        max-width: 95vw;
        max-height: 95vh;
    }
    
    #attachmentContent {
        padding: 12px;
    }
    
    #attachmentContent img,
    #attachmentContent video {
        max-height: calc(95vh - 120px);
    }
    
    #attachmentContent iframe {
        min-height: calc(95vh - 120px);
    }
}

/* Loading states */
.attachment-loading {
    opacity: 0.6;
    pointer-events: none;
}

.attachment-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3b82f6;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.attachment-error {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.1);
}

.attachment-error-message {
    color: #fca5a5;
    font-size: 12px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.attachment-error-message::before {
    content: '⚠️';
    font-size: 14px;
}

/* Preview thumbnails */
.attachment-thumbnail {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #4b5563;
}

.attachment-placeholder {
    width: 48px;
    height: 48px;
    background: #4b5563;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #9ca3af;
}

/* Progress indicators */
.upload-progress {
    width: 100%;
    height: 4px;
    background: #4b5563;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 8px;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.upload-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Compact mode for mobile */
@media (max-width: 640px) {
    .file-upload-area {
        padding: 12px;
        font-size: 14px;
    }
    
    .attachment-thumbnail,
    .attachment-placeholder {
        width: 36px;
        height: 36px;
    }
    
    .file-icon {
        font-size: 18px;
        min-width: 24px;
    }
}