﻿/**
 * Fotogalerie - čtvercová mřížka s inline editací
 */

/* Upload area */
.photo-uploader {
    margin-bottom: 2rem;
}

.upload-area {
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: 12px;
    padding: 2.5rem 2rem;
    text-align: center;
    background: var(--color-white, #ffffff);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border: 2px dashed transparent;
    border-radius: 12px;
    margin: 8px;
    transition: all 0.3s ease;
    pointer-events: none;
}

.upload-area:hover::before,
.upload-area.dragover::before {
    border-color: var(--color-primary, #2F92AF);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--color-primary, #2F92AF);
    background: var(--color-bg-light, #fafafa);
    box-shadow: 0 4px 12px rgba(201, 169, 126, 0.08);
}

.upload-area i {
    font-size: 3rem;
    color: var(--color-text-light, #9ca3af);
    margin-bottom: 1rem;
    display: block;
    transition: all 0.3s ease;
}

.upload-area:hover i,
.upload-area.dragover i {
    color: var(--color-primary, #2F92AF);
    transform: scale(1.05);
}

.upload-area p {
    margin: 0.75rem 0;
    color: var(--color-text, #1f2937);
    font-size: 0.95rem;
    font-weight: 500;
}

.upload-area .upload-btn {
    color: var(--color-primary, #2F92AF);
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 1px solid var(--color-primary, #2F92AF);
    transition: opacity 0.2s ease;
}

.upload-area .upload-btn:hover {
    opacity: 0.8;
}

.upload-area small {
    color: var(--color-text-light, #9ca3af);
    font-size: 0.8rem;
    display: block;
    margin-top: 0.5rem;
}

/* Progress */
.upload-progress {
    padding: 1.5rem;
}

.progress-bar {
    background: var(--color-bg-light, #f3f4f6);
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-fill {
    background: linear-gradient(90deg, var(--color-primary, #2F92AF), var(--color-accent, #155564));
    height: 100%;
    width: 0;
    transition: width 0.4s ease;
    animation: progress-pulse 1.5s infinite;
    border-radius: 8px;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.progress-text {
    color: var(--color-text, #1f2937);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

/* Photo grid - čtvercová mřížka */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Photo item */
.photo-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: #f5f5f5;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.photo-item.dragging {
    opacity: 0.5;
    transform: scale(1.05);
}

/* Photo link a obrázek */
.photo-link {
    display: block;
    width: 100%;
    height: 100%;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

/* Akční tlačítka */
.photo-actions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-item:hover .photo-actions {
    opacity: 1;
}

.photo-actions span {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.photo-actions span:hover {
    background: var(--primary-color, #2F92AF);
    color: white;
}

.drag-handle {
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    width: 16px;
    height: 16px;
    display: block;
}

.delete-photo:hover {
    background: #e74c3c !important;
    color: white !important;
}

/* Caption */
.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: white;
    font-size: 12px;
    line-height: 1.3;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-item:hover .photo-caption {
    opacity: 1;
}

/* Inline edit popisu */
.photo-desc-edit {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(255,255,255,0.95);
    border-top: 1px solid #eee;
    z-index: 10;
}

.photo-desc-edit input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.photo-desc-edit input:focus {
    border-color: var(--primary-color, #2F92AF);
    outline: none;
}

.photo-desc-edit button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 5px;
}

.photo-desc-edit .save-desc {
    background: var(--primary-color, #2F92AF);
    color: white;
    font-weight: 600;
}

.photo-desc-edit .save-desc:hover {
    background: var(--primary-dark, #155564);
}

.photo-desc-edit .cancel-desc {
    background: #eee;
    color: #666;
}

.photo-desc-edit .cancel-desc:hover {
    background: #ddd;
}

/* Dokumenty */

.page-documents__item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
}

.page-documents__item {
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Document extension badge */
.doc-extension {
    color: var(--color-text-light, #9ca3af);
    font-size: 0.85em;
    font-weight: 500;
    margin-left: 0.35rem;
}

/* Document actions */
.document-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.document-actions span {
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.document-actions span:hover {
    background: var(--primary-color, #2F92AF);
    color: white;
}

.document-actions .drag-handle {
    cursor: grab;
}

.document-actions .drag-handle:active {
    cursor: grabbing;
}

.document-actions .drag-handle svg {
    width: 14px;
    height: 14px;
    display: block;
}

.document-actions .delete-document:hover {
    background: #e74c3c !important;
    color: white !important;
}

/* Inline edit názvu dokumentu */
.page-documents__item.is-editing {
    flex-wrap: wrap;
}

.page-documents__item.is-editing,
.page-documents__item.is-editing:hover {
    transform: none;
}

.doc-title-edit {
    flex: 0 0 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border, #e5e7eb);
    box-sizing: border-box;
}

.doc-title-edit input {
    flex: 1 1 120px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    box-sizing: border-box;
}

.doc-title-edit input:focus {
    border-color: var(--primary-color, #2F92AF);
    outline: none;
}

.doc-title-edit button {
    padding: 8px 14px;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.doc-title-edit .save-title {
    background: var(--primary-color, #2F92AF);
    color: white;
    font-weight: 600;
}

.doc-title-edit .save-title:hover {
    background: var(--primary-dark, #155564);
}

.doc-title-edit .cancel-title {
    background: #eee;
    color: #666;
}

.doc-title-edit .cancel-title:hover {
    background: #ddd;
}

/* ===== Výběr více fotek a hromadné smazání (gallery-manager.js) ===== */
.photo-bulk {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    margin: 10px 0 0;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--blue, var(--primary-color, #1a6fb8));
    color: #fff;
    font-size: 14px;
}
.photo-bulk[hidden] { display: none; }
.photo-bulk__count { margin-right: auto; font-weight: 600; }
.photo-bulk__btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 999px;
    background: transparent;
    color: #fff;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
.photo-bulk__btn:hover { background: rgba(255, 255, 255, 0.15); }
.photo-bulk__btn--danger { border-color: #fff; background: #d32f2f; }
.photo-bulk__btn--danger:hover { background: #b71c1c; }
.photo-bulk__btn:disabled { opacity: 0.6; cursor: wait; }

.photo-select {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}
.photo-select svg { opacity: 0; }
.photo-item:hover .photo-select,
.photo-select:focus-visible,
.photo-grid.is-selecting .photo-select { opacity: 1; }
.photo-item.is-selected .photo-select { background: var(--blue, var(--primary-color, #1a6fb8)); opacity: 1; }
.photo-item.is-selected .photo-select svg { opacity: 1; }
.photo-item.is-selected::after,
.photo-item.is-marquee::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    border: 3px solid var(--blue, var(--primary-color, #1a6fb8));
    border-radius: inherit;
    background: rgba(26, 111, 184, 0.18);
    pointer-events: none;
}
.photo-item.is-marquee:not(.is-selected)::after { border-style: dashed; }
.photo-grid.is-selecting .photo-link { cursor: pointer; }

.photo-marquee {
    position: fixed;
    z-index: 1000;
    border: 1px solid var(--blue, var(--primary-color, #1a6fb8));
    background: rgba(26, 111, 184, 0.12);
    pointer-events: none;
}

/* ===== Videa v galerii (nahraný soubor nebo YouTube) ===== */

/* Odkaz na YouTube pod polem pro soubory */
.upload-link {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.9rem;
    position: relative;
    z-index: 1;
}
.upload-link[hidden] { display: none; }

.upload-link__input {
    flex: 1 1 auto;
    max-width: 420px;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--color-border, #cbd5e1);
    border-radius: 6px;
    font: inherit;
    font-size: 0.9rem;
}

.upload-link__submit {
    padding: 0.55rem 1rem;
    border: 0;
    border-radius: 6px;
    background: var(--color-primary, var(--primary-color, var(--primary, #1f2937)));
    color: #fff;
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
}

.upload-link__submit:hover {
    filter: brightness(1.1);
}

/* Odznak přehrání na dlaždici videa (admin mřížka, veřejná mřížka i karta karuselu) */
.gallery-card__image {
    position: relative;
}

.photo-play {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 1;
    transition: transform 0.3s ease, background 0.3s ease;
}

.photo-play svg {
    margin-left: 3px;
}

.photo-item--video:hover .photo-play,
.gallery-card:hover .photo-play {
    transform: scale(1.08);
    background: var(--color-primary, var(--primary-color, var(--primary, rgba(0, 0, 0, 0.85))));
}

/* Lightbox: přehrávač nahraného videa a vložený přehrávač YouTube */
.lightbox-video {
    display: none;
    max-width: min(92vw, 1200px);
    max-height: 80vh;
    border-radius: 8px;
    background: #000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.lightbox-video.is-visible {
    display: block;
}

.lightbox-embed {
    display: none;
    width: min(92vw, 1200px, calc(80vh * 16 / 9));
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.lightbox-embed.is-visible {
    display: block;
}

.lightbox-embed iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

.lightbox-image.is-hidden {
    display: none;
}

.lightbox-thumb--video {
    position: relative;
}

.lightbox-thumb--video::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0;
    height: 0;
    transform: translate(-40%, -50%);
    border-left: 9px solid #fff;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}

/* ===== Fotka u aktuality se zvětší v lightboxu (sama, bez listování) ===== */
.info-item__image a.photo-link,
.news-card__media a.photo-link,
.hp-news__card-image a.photo-link {
    display: block;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}

.lightbox-overlay--single .lightbox-nav,
.lightbox-overlay--single .lightbox-thumbs {
    display: none;
}
