/* Attachment Upload Styles with Mobile Optimization */

.attachment-upload-area {
    margin-bottom: 1rem;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: #8A2A2B;
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.upload-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

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

.upload-icon {
    width: 48px;
    height: 48px;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.upload-text {
    font-size: 1.1rem;
    font-weight: 500;
    color: #495057;
    margin-bottom: 0.25rem;
}

.upload-subtext {
    font-size: 0.9rem;
    color: #6c757d;
}

/* Mobile Camera Actions */
.mobile-camera-actions {
    display: none;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.mobile-camera-btn,
.mobile-files-btn {
    flex: 1;
    max-width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 44px;
    font-size: 0.9rem;
}

/* Upload Progress */
.upload-progress {
    margin-top: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.upload-status {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Attached Files */
.attached-files {
    margin-top: 1rem;
}

.attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
}

.attachment-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.attachment-content {
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.attachment-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

.attachment-icon {
    width: 32px;
    height: 32px;
    color: #6c757d;
    margin-right: 0.75rem;
    flex-shrink: 0;
}

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

.attachment-name {
    font-weight: 500;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.attachment-size {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.1rem;
}

.attachment-status {
    font-size: 0.75rem;
    margin-top: 0.2rem;
    font-weight: 500;
}

.attachment-status.uploaded {
    color: #198754;
}

.attachment-status.error {
    color: #dc3545;
}

.remove-attachment {
    min-width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Image Gallery */
.attachment-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.gallery-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

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

.gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.gallery-item:hover .gallery-overlay {
    opacity: 1;
}

.gallery-overlay i {
    color: white;
    width: 24px;
    height: 24px;
}

/* Document Items */
.document-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
}

.document-item:hover {
    background: #f8f9fa;
    text-decoration: none;
    color: inherit;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.document-icon {
    width: 40px;
    height: 40px;
    margin-right: 1rem;
    color: #6c757d;
    flex-shrink: 0;
}

.document-details {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 500;
    color: #212529;
    margin-bottom: 0.25rem;
}

.document-meta {
    font-size: 0.85rem;
    color: #6c757d;
}

/* Responsive Design */

/* Mobile First (up to 576px) */
@media (max-width: 575.98px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
    
    .mobile-camera-actions {
        display: flex;
    }
    
    .upload-zone {
        padding: 1.5rem 1rem;
    }
    
    .upload-icon {
        width: 40px;
        height: 40px;
    }
    
    .upload-text {
        font-size: 1rem;
    }
    
    .attachment-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .gallery-image {
        height: 120px;
    }
    
    .attachment-item {
        padding: 0.5rem;
    }
    
    .attachment-thumbnail {
        width: 40px;
        height: 40px;
        margin-right: 0.5rem;
    }
    
    .attachment-name {
        font-size: 0.85rem;
    }
    
    .attachment-size {
        font-size: 0.75rem;
    }
    
    .remove-attachment {
        min-width: 36px;
        height: 36px;
    }
}

/* Tablet (576px to 991.98px) */
@media (min-width: 576px) and (max-width: 991.98px) {
    .attachment-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mobile-camera-actions {
        display: flex;
        max-width: 400px;
        margin: 1rem auto 0;
    }
}

/* Desktop (992px and up) */
@media (min-width: 992px) {
    .mobile-only {
        display: none !important;
    }
    
    .desktop-only {
        display: block !important;
    }
    
    .attachment-gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Large Desktop (1200px and up) */
@media (min-width: 1200px) {
    .attachment-gallery {
        grid-template-columns: repeat(5, 1fr);
    }
}

/* Touch Device Optimizations */
.mobile-device .upload-zone {
    padding: 2rem 1rem;
    min-height: 120px;
}

.mobile-device .attachment-item {
    min-height: 60px;
}

.mobile-device .remove-attachment {
    min-width: 44px;
    height: 44px;
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .attachment-thumbnail {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .upload-zone {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .upload-zone:hover,
    .upload-zone.drag-over {
        background: #1a202c;
        border-color: #8A2A2B;
    }
    
    .upload-text {
        color: #e2e8f0;
    }
    
    .upload-subtext {
        color: #a0aec0;
    }
    
    .upload-icon {
        color: #a0aec0;
    }
    
    .mobile-camera-actions .btn-outline-primary {
        background: #2d3748;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .mobile-camera-actions .btn-outline-primary:hover {
        background: #4a5568;
        color: #ffffff;
        border-color: #8A2A2B;
    }
    
    .mobile-camera-actions .btn-outline-secondary {
        background: #2d3748;
        color: #a0aec0;
        border-color: #4a5568;
    }
    
    .mobile-camera-actions .btn-outline-secondary:hover {
        background: #4a5568;
        color: #ffffff;
        border-color: #6c757d;
    }
    
    .upload-progress {
        background: #2d3748;
        border: 1px solid #4a5568;
    }
    
    .upload-status {
        color: #a0aec0;
    }
    
    .attachment-item {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .attachment-item:hover {
        background: #374151;
        border-color: #6b7280;
    }
    
    .attachment-name {
        color: #e2e8f0;
    }
    
    .attachment-size {
        color: #a0aec0;
    }
    
    .attachment-icon {
        color: #a0aec0;
    }
    
    .attachment-status {
        color: #a0aec0;
    }
    
    .attachment-status.uploaded {
        color: #68d391;
    }
    
    .attachment-status.error {
        color: #fc8181;
    }
    
    .remove-attachment {
        background: transparent;
        color: #a0aec0;
        border-color: #4a5568;
    }
    
    .remove-attachment:hover {
        background: #dc3545;
        color: #ffffff;
        border-color: #dc3545;
    }
    
    .document-item {
        background: #2d3748;
        border-color: #4a5568;
    }
    
    .document-item:hover {
        background: #1a202c;
    }
    
    .document-name {
        color: #e2e8f0;
    }
    
    .document-meta {
        color: #a0aec0;
    }
    
    .document-icon {
        color: #a0aec0;
    }
    
    .gallery-overlay {
        background: rgba(0,0,0,0.7);
    }
    
    .alert-danger {
        background: #2d1b1e;
        color: #fc8181;
        border-color: #5a2d31;
    }
}

/* Animation for loading states */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.attachment-item.uploading {
    animation: pulse 2s infinite;
}

/* Accessibility */
.upload-zone:focus-within {
    outline: 2px solid #8A2A2B;
    outline-offset: 2px;
}

.remove-attachment:focus {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .attachment-upload-area,
    .mobile-camera-actions,
    .remove-attachment {
        display: none;
    }
    
    .attachment-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .gallery-image {
        height: 100px;
    }
}