/**
 * PeteIT Frontend Blog - Enhanced Upload UI Styles
 */

/* File Item Grid Layout */
#preview-image-container,
#content-files-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    background: #f8f9fa;
    min-height: 100px;
}

/* Individual File Item */
.file-item {
    position: relative;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    overflow: hidden;
    cursor: pointer;
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.file-item.file-uploading {
    opacity: 0.7;
    pointer-events: none;
}

.file-item.file-uploading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.file-item.file-success {
    border: 2px solid #28a745;
}

.file-item.file-error {
    border: 2px solid #dc3545;
}

/* File Thumbnail */
.file-thumbnail {
    position: relative;
    width: 100%;
    height: 100px;
    overflow: hidden;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.file-item:hover .file-thumbnail img {
    transform: scale(1.05);
}

.file-icon-thumbnail {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.file-icon-large {
    font-size: 2.5em;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* File Overlay */
.file-overlay {
    position: absolute;
    top: 5px;
    right: 5px;
}

.file-type-badge {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
}

/* File Info */
.file-info {
    padding: 10px;
    border-top: 1px solid #e9ecef;
}

.filename {
    font-weight: 600;
    font-size: 12px;
    color: #495057;
    margin-bottom: 4px;
    line-height: 1.2;
    word-break: break-word;
}

.file-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: #6c757d;
    flex-wrap: wrap;
    gap: 4px;
}

.file-size {
    background: #e9ecef;
    padding: 1px 4px;
    border-radius: 3px;
}

.file-label {
    background: #007cba;
    color: white;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* File Actions */
.file-actions {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-item:hover .file-actions {
    opacity: 1;
}

.button-icon {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: rgba(0,0,0,0.8);
    color: white;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.button-icon:hover {
    background: #007cba;
    transform: scale(1.1);
}

.button-icon.delete-file:hover {
    background: #dc3545;
}

.button-icon.download-btn:hover {
    background: #28a745;
}

.button-icon.preview-btn:hover {
    background: #17a2b8;
}

/* Upload Zone Enhancements */
.upload-zone {
    position: relative;
    min-height: 120px;
    border: 2px dashed #007cba;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transition: all 0.3s ease;
}

.upload-zone:hover {
    border-color: #0056b3;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    transform: translateY(-1px);
}

.upload-zone.drag-over {
    border-color: #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    transform: scale(1.02);
}

.file-counter {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #007cba;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    z-index: 10;
}

/* Modal Styles */
.file-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    cursor: pointer;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: none;
    background: rgba(0,0,0,0.8);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    z-index: 10;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: #dc3545;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    display: block;
}

.modal-info {
    padding: 15px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.modal-info h3 {
    margin: 0;
    font-size: 14px;
    color: #495057;
}

/* Progress Bar Enhancements */
.progress-container {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 15px;
    z-index: 1000;
    border-left: 4px solid #007cba;
}

.progress-fill {
    height: 6px;
    background: linear-gradient(90deg, #007cba, #0056b3);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.progress-text {
    margin-top: 8px;
    font-size: 12px;
    color: #6c757d;
    text-align: center;
}

/* Message Enhancements */
#form-messages .message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
    border-left: 4px solid;
    animation: slideInDown 0.3s ease;
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.success {
    background: #d4edda;
    color: #155724;
    border-left-color: #28a745;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border-left-color: #dc3545;
}

.message.warning {
    background: #fff3cd;
    color: #856404;
    border-left-color: #ffc107;
}

/* Responsive Design */
@media (max-width: 768px) {
    #preview-image-container,
    #content-files-container {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
        padding: 8px;
    }
    
    .file-thumbnail {
        height: 80px;
    }
    
    .file-info {
        padding: 8px;
    }
    
    .filename {
        font-size: 11px;
    }
    
    .file-meta {
        font-size: 9px;
    }
    
    .progress-container {
        width: 250px;
        right: 10px;
        top: 10px;
    }
}

@media (max-width: 480px) {
    #preview-image-container,
    #content-files-container {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .file-thumbnail {
        height: 70px;
    }
    
    .modal-content {
        max-width: 95vw;
        max-height: 95vh;
    }
}

/* Empty State */
.upload-container:empty::after {
    content: 'Keine Dateien hochgeladen';
    display: block;
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 20px;
}
