/* Ticket Attachments CSS */

/* Upload Container */
.attachments-upload-container {
    margin: 20px 0;
}

.attachments-upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    background: #f9fafb;
    transition: all 0.3s;
    cursor: pointer;
}

.attachments-upload-area:hover {
    border-color: #667eea;
    background: #f3f4f6;
}

.attachments-upload-area.drag-over {
    border-color: #667eea;
    background: #eff6ff;
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.upload-text h4 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

.upload-text p {
    margin: 0 0 15px 0;
    color: #6b7280;
    font-size: 14px;
}

.upload-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.upload-btn,
.camera-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.upload-btn {
    background: #667eea;
    color: #fff;
}

.upload-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.camera-btn {
    background: #10b981;
    color: #fff;
}

.camera-btn:hover {
    background: #059669;
    transform: translateY(-2px);
}

.attachment-file-input {
    display: none;
}

.upload-hint {
    margin-top: 10px;
    font-size: 12px;
    color: #9ca3af;
}

/* Attachments Preview */
.attachments-preview {
    margin-top: 20px;
}

.attachments-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
}

.attachment-preview {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: all 0.3s;
}

.attachment-preview:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.attachment-preview.uploading {
    opacity: 0.6;
}

.preview-image {
    width: 100%;
    height: 120px;
    overflow: hidden;
    background: #f3f4f6;
}

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

.preview-file {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    height: 120px;
}

.preview-file .file-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.preview-file .file-name {
    font-size: 12px;
    color: #6b7280;
    text-align: center;
    word-break: break-word;
}

.delete-preview {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.delete-preview:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #667eea;
    animation: progressAnimation 1.5s infinite;
}

.attachment-preview:not(.uploading) .upload-progress {
    display: none;
}

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

/* Camera Modal */
#camera-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 99999;
    padding: 20px;
}

.camera-modal-content {
    max-width: 800px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.camera-container {
    width: 100%;
    max-width: 640px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

#camera-video,
#camera-preview {
    width: 100%;
    height: auto;
    display: block;
}

#camera-preview {
    display: none;
}

#camera-canvas {
    display: none;
}

.camera-controls,
.camera-preview-controls {
    padding: 20px;
    text-align: center;
}

.camera-preview-controls {
    display: none;
}

.camera-controls button,
.camera-preview-controls button {
    margin: 0 10px;
}

.capture-photo-btn,
.use-photo-btn {
    padding: 12px 30px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.capture-photo-btn:hover,
.use-photo-btn:hover {
    background: #5568d3;
}

.retake-photo-btn,
.cancel-camera-btn {
    padding: 12px 30px;
    background: #6b7280;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.retake-photo-btn:hover,
.cancel-camera-btn:hover {
    background: #4b5563;
}

.close-camera-modal {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.close-camera-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Attachments Gallery (Display) */
.ticket-attachments-section {
    margin: 25px 0;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.ticket-attachments-section h4 {
    margin: 0 0 15px 0;
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
}

.attachments-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.attachment-item {
    position: relative;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    transition: all 0.3s;
}

.attachment-item:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.attachment-image .attachment-preview {
    display: block;
}

.attachment-image .attachment-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.delete-attachment {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    z-index: 10;
}

.delete-attachment:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* Files List */
.attachments-files {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.attachment-file {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
}

.attachment-file .file-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    text-decoration: none;
    color: #1f2937;
    transition: all 0.3s;
}

.attachment-file .file-link:hover {
    background: #f9fafb;
}

.file-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.file-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-weight: 600;
    color: #1f2937;
}

.file-size {
    font-size: 12px;
    color: #6b7280;
}

/* Message Attachments */
.message-attachments {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.message-attachments .attachments-gallery {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
}

.message-attachments .attachment-image .attachment-preview img {
    height: 100px;
}

/* Responsive */
@media (max-width: 768px) {
    .attachments-upload-area {
        padding: 20px;
    }
    
    .upload-icon {
        font-size: 36px;
    }
    
    .upload-text h4 {
        font-size: 16px;
    }
    
    .upload-buttons {
        flex-direction: column;
    }
    
    .upload-btn,
    .camera-btn {
        width: 100%;
        justify-content: center;
    }
    
    .attachments-preview {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .attachments-gallery {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
    
    #camera-modal {
        padding: 10px;
    }
    
    .camera-controls button,
    .camera-preview-controls button {
        padding: 10px 20px;
        font-size: 14px;
        margin: 5px;
    }
}

/* Empty State */
.no-attachments {
    text-align: center;
    padding: 30px;
    color: #9ca3af;
}

.no-attachments-icon {
    font-size: 48px;
    margin-bottom: 10px;
}