/**
 * Forum Attachments Styles
 */

/* Upload Section */
.forum-upload-section {
    margin: 1rem 0;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.forum-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    position: relative;
}

.forum-upload-area:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.forum-upload-area.dragover {
    border-color: #3b82f6;
    background: #eff6ff;
    transform: scale(1.02);
}

.forum-file-input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 1rem;
    color: #374151;
    margin-bottom: 0.25rem;
}

.upload-hint {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Attachment Preview List */
.attachment-preview-list {
    margin-top: 1rem;
}

.attachment-preview {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.attachment-preview:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.attachment-preview.uploaded {
    border-color: #10b981;
    background: #f0fdf4;
}

.preview-content {
    display: flex;
    align-items: center;
    width: 100%;
}

.preview-image {
    width: 60px;
    height: 60px;
    border-radius: 0.375rem;
    overflow: hidden;
    margin-right: 1rem;
    flex-shrink: 0;
}

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

.preview-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 0.375rem;
    margin-right: 1rem;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.preview-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: #1f2937;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.file-size {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.upload-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upload-progress-bar {
    flex: 1;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.upload-progress {
    height: 100%;
    background: #3b82f6;
    border-radius: 2px;
    transition: width 0.2s ease;
}

.status-text {
    font-size: 0.875rem;
    color: #6b7280;
}

.status-success {
    font-size: 0.875rem;
    color: #10b981;
    font-weight: 500;
}

.remove-attachment {
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.remove-attachment:hover {
    background: #dc2626;
}

/* Display Attachments */
.forum-attachments {
    margin: 1.5rem 0;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.attachments-title {
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.attachments-title:before {
    content: "📎";
    font-size: 1rem;
}

.attachment-list {
    display: grid;
    gap: 0.75rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
}

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

.attachment-image {
    width: 80px;
    height: 80px;
    border-radius: 0.375rem;
    overflow: hidden;
    margin-right: 1rem;
    flex-shrink: 0;
}

.attachment-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.attachment-info {
    flex: 1;
    min-width: 0;
}

.attachment-name {
    margin-bottom: 0.25rem;
}

.attachment-name a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    word-break: break-word;
}

.attachment-name a:hover {
    text-decoration: underline;
    color: #1d4ed8;
}

.attachment-meta {
    font-size: 0.875rem;
    color: #6b7280;
}

/* Messages */
.forum-message {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.forum-message-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.forum-message-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* Responsive Design */
@media (max-width: 640px) {
    .forum-upload-area {
        padding: 1.5rem 1rem;
    }
    
    .upload-icon {
        font-size: 1.5rem;
    }
    
    .upload-text {
        font-size: 0.875rem;
    }
    
    .upload-hint {
        font-size: 0.75rem;
    }
    
    .attachment-preview,
    .attachment-item {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    
    .preview-image,
    .preview-icon,
    .attachment-image {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .preview-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .upload-status {
        width: 100%;
        margin-top: 0.5rem;
    }
}

/* Loading States */
.attachment-preview.uploading {
    opacity: 0.7;
}

.attachment-preview.uploading .preview-image,
.attachment-preview.uploading .preview-icon {
    position: relative;
}

.attachment-preview.uploading .preview-image:after,
.attachment-preview.uploading .preview-icon:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .forum-upload-section {
        background: #1f2937;
        border-color: #374151;
    }
    
    .forum-upload-area {
        background: #111827;
        border-color: #4b5563;
    }
    
    .forum-upload-area:hover {
        background: #1f2937;
    }
    
    .upload-text {
        color: #e5e7eb;
    }
    
    .upload-hint {
        color: #9ca3af;
    }
    
    .attachment-preview,
    .attachment-item {
        background: #111827;
        border-color: #374151;
    }
    
    .file-name {
        color: #e5e7eb;
    }
    
    .forum-attachments {
        background: #1f2937;
        border-color: #374151;
    }
    
    .attachments-title {
        color: #e5e7eb;
    }
}