/* ==================== bild-editor.twig ==================== */
#bild-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
}

.bild-editor-modal-dialog {
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    max-width: 90%;
    margin: 20px auto;
    max-height: 90vh;
    overflow-y: auto;
}

.bild-editor-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.bild-editor-modal-title {
    margin: 0;
    font-size: 1.25rem;
    color: #333;
}

.bild-editor-modal-body {
    padding: 20px;
}

.bild-editor-modal-body input[type="file"] {
    display: none;
}

#versionUploadInput {
    display: none;
}

.version-upload-input {
    display: none;
}

.bild-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.version-tile {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    transition: all 0.2s ease;
    cursor: pointer;
}

.version-tile:hover {
    border-color: #0066cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.version-tile-content {
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

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

.image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #999;
    padding: 20px;
}

.image-placeholder i {
    font-size: 32px;
}

.image-placeholder[style*="display: none"] {
    display: none;
}

.version-tile-info {
    padding: 10px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.version-groesse-label {
    font-weight: bold;
    font-size: 0.75rem;
    color: #333;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.version-resolution {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
}

.version-filename {
    font-size: 0.75rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
}

.version-filesize {
    font-size: 0.7rem;
    color: #aaa;
}

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

.version-tile:hover .version-tile-overlay {
    opacity: 1;
}

.version-upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.version-upload-btn:hover {
    background: #0052a3;
}

.version-upload-btn i {
    font-size: 1.2rem;
}

.bild-editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.bild-editor-close {
    padding: 8px 20px;
    background: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.bild-editor-close:hover {
    background: #5a6268;
}

.version-tile.loading .version-tile-info {
    opacity: 0.5;
}

.version-tile.loading .image-placeholder::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== bild-editor-modal.twig ==================== */

.bild-editor-modal .modal-body input[type="file"] {
    display: none;
}

.bild-editor-modal .bild-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 15px;
}

.bild-editor-modal .version-tile {
    position: relative;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f8f9fa;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.bild-editor-modal .version-tile--original {
    border-color: #6c757d;
}

.bild-editor-modal .version-tile:hover {
    border-color: #0066cc;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.bild-editor-modal .version-tile-content {
    width: 100%;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

.bild-editor-modal .version-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.bild-editor-modal .image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: #aaa;
    font-size: 0.75rem;
    padding: 10px;
    text-align: center;
}

.bild-editor-modal .image-placeholder i {
    font-size: 28px;
}

.bild-editor-modal .version-tile-info {
    padding: 8px 10px;
    background: #fafafa;
    border-top: 1px solid #eee;
}

.bild-editor-modal .version-groesse-label {
    font-weight: bold;
    font-size: 0.7rem;
    color: #333;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.bild-editor-modal .version-resolution,
.bild-editor-modal .version-filename,
.bild-editor-modal .version-filesize,
.bild-editor-modal .version-note {
    font-size: 0.7rem;
    color: #888;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bild-editor-modal .version-note {
    color: #6c757d;
    font-style: italic;
    margin-top: 2px;
}

.bild-editor-modal .version-tile-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.bild-editor-modal .version-tile:hover .version-tile-overlay {
    opacity: 1;
    pointer-events: auto;
}

.bild-editor-modal .version-upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: #0066cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 10px 18px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.bild-editor-modal .version-upload-btn:hover {
    background: #0052a3;
}

.bild-editor-modal .version-upload-btn i {
    font-size: 1.1rem;
}

.bild-editor-modal .version-tile.loading .version-tile-content {
    opacity: 0.4;
}

.bild-editor-modal .version-tile.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 28px;
    height: 28px;
    margin: -14px 0 0 -14px;
    border: 3px solid #ccc;
    border-top-color: #0066cc;
    border-radius: 50%;
    animation: be-spin 0.8s linear infinite;
    z-index: 20;
    pointer-events: none;
}

@keyframes be-spin {
    to { transform: rotate(360deg); }
}

/* ==================== bild-preview-modal.twig ==================== */

#bild-preview-modal .modal-body {
    background: #1a1a1a;
    min-height: 300px;
}

#bild-preview-modal .modal-body img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 4px;
}

/* ==================== galerie-overview.twig ==================== */

.galerie-container {
    padding: 20px;
}

#bildUploadInput {
    display: none;
}

.bilder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
    min-height: 200px;
}

.bild-item {
    position: relative;
    aspect-ratio: 1;
    border: 2px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    cursor: move;
    background: #f5f5f5;
    transition: all 0.2s ease;
    user-select: none;
}

.bild-item[draggable="true"] {
    cursor: grab;
}

.bild-item[draggable="true"]:active {
    cursor: grabbing;
}

.bild-item.placeholder {
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px dashed #999;
    background: #fafafa;
    overflow: visible;
}

.bild-item.placeholder[draggable="false"] {
    cursor: pointer;
}

/* Datei-Drop aus dem OS auf das Grid */
.bilder-grid.file-drag-over {
    outline: 2px dashed #0d6efd;
    outline-offset: 4px;
    background: rgba(13, 110, 253, 0.05);
}

.bild-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.bild-content img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.plus-icon {
    font-size: 48px;
    font-weight: bold;
    color: #999;
    pointer-events: none;
    user-select: none;
}

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

.bild-item.placeholder:hover {
    border-color: #666;
    background: #f0f0f0;
}

.bild-item:hover .bild-toolbar {
    display: flex !important;
}

.bild-toolbar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    display: none;
    gap: 5px;
    padding: 8px;
    justify-content: center;
    z-index: 10;
    pointer-events: auto;
}

/* Weil Parent keine Pointer events hat */
.bild-toolbar a {
    pointer-events: auto;
}

.bild-toolbar .btn-xs:hover {
    filter: brightness(1.2);
    transition: filter 0.15s ease;
}

.bild-item.dragging {
    opacity: 0.5;
    z-index: 1000;
}

.bild-item.drag-over {
    border-color: #0066cc;
    background-color: #f0f8ff;
}

/* Unpublished */
.bild-item.bild-unpublished .uploaded-image-preview {
    filter: grayscale(60%) opacity(55%);
}

.bild-unpublished-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(0,0,0,0.55);
    color: #fff;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    pointer-events: none;
    z-index: 5;
}
