/**
 * Custom Gallery Uploader - Styles pre ADMR plugin
 */

/* Hlavný kontajner */
.cgu-uploader-container {
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Drop zone */
.cgu-drop-zone {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 40px 20px;
    text-align: center;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
}

.cgu-drop-zone:hover {
    border-color: #0073aa;
    background: #f0f7ff;
}

.cgu-drop-zone.cgu-drag-over {
    border-color: #0073aa;
    background: #e7f3ff;
    transform: scale(1.02);
}

.cgu-drop-zone.cgu-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.cgu-drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.cgu-drop-icon {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 10px;
}

.cgu-drop-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
    margin: 0;
}

.cgu-drop-hint {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Counter */
.cgu-counter-container {
    text-align: right;
    margin-bottom: 10px;
}

.cgu-counter {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

/* File input (skrytý) */
#cgu-file-input {
    display: none;
}

/* Image grid */
.cgu-image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .cgu-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
}

/* Image preview */
.cgu-image-preview {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: move;
    position: relative;
}

.cgu-image-preview:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.cgu-image-preview.sortable-ghost {
    opacity: 0.5;
}

.cgu-image-preview.sortable-chosen {
    transform: scale(1.05);
    z-index: 1000;
}

/* Image container */
.cgu-image-container {
    position: relative;
    width: 100%;
    height: 150px;
    overflow: hidden;
}

.cgu-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.cgu-image-preview:hover .cgu-image {
    transform: scale(1.05);
}

/* Overlay */
.cgu-image-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.3s ease;
}

.cgu-image-preview:hover .cgu-image-overlay {
    opacity: 1;
}

/* Delete button */
.cgu-delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cgu-delete-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.cgu-delete-btn .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Image info */
.cgu-image-info {
    padding: 12px;
}

.cgu-filename {
    display: block;
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cgu-description {
    width: 100%;
    margin-top: 5px;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 12px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.cgu-description:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

/* Reorder hint */
.cgu-reorder-hint {
    text-align: center;
    font-size: 12px;
    color: #666;
    font-style: italic;
    margin-top: 10px;
}

/* Upload progress */
.cgu-upload-progress {
    position: fixed;
    top: 32px;
    right: 20px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 10000;
    min-width: 250px;
}

.cgu-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cgu-progress-title {
    font-weight: 600;
    font-size: 14px;
}

.cgu-progress-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 20px;
    height: 20px;
}

.cgu-progress-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
}

.cgu-progress-filename {
    flex: 1;
    margin-right: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cgu-progress-status {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    white-space: nowrap;
}

.cgu-progress-status.uploading {
    background: #e3f2fd;
    color: #1976d2;
}

.cgu-progress-status.success {
    background: #e8f5e8;
    color: #2e7d2e;
}

.cgu-progress-status.error {
    background: #ffebee;
    color: #c62828;
}

/* Loading states */
.cgu-loading {
    position: relative;
}

.cgu-loading::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;
}

.cgu-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: cgu-spin 1s linear infinite;
    z-index: 1;
}

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

/* Error states */
.cgu-error {
    background: #ffebee;
    border: 1px solid #f44336;
    color: #c62828;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

.cgu-success {
    background: #e8f5e8;
    border: 1px solid #4caf50;
    color: #2e7d2e;
    padding: 10px;
    border-radius: 4px;
    margin: 10px 0;
    font-size: 14px;
}

/* Responsive design */
@media (max-width: 480px) {
    .cgu-drop-zone {
        padding: 30px 15px;
    }
    
    .cgu-drop-icon {
        font-size: 36px;
    }
    
    .cgu-image-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .cgu-image-container {
        height: 120px;
    }
    
    .cgu-upload-progress {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}
