/* Auto Gallery Pro - Frontend Styles */

/* === GALERIE === */
.agp-auto-gallery {
    margin: 2rem 0;
    padding-top: 30px;
}

.agp-gallery-title {
    font-size: 30px;
    font-weight: 300;
    margin: 0 0 1.5rem 0;
    color: #1a1a1a;
}

.agp-gallery-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--agp-gap, 15px);
    justify-content: var(--agp-justify, flex-start);
}

.agp-gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: rgba(0, 0, 0, 0.1) 0px 20px 25px -5px, rgba(0, 0, 0, 0.04) 0px 10px 10px -5px;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    width: var(--agp-thumb-width, 350px);
    height: var(--agp-thumb-height, 250px);
    border-radius: var(--agp-radius, 8px);
    border: 1px solid white;
}

.agp-gallery-item:hover {
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.1);
}

.agp-lightbox-trigger {
    display: block;
    width: 100%;
    height: 100%;
}

.agp-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.agp-gallery-item:hover .agp-thumbnail {
    transform: scale(1.08);
}

/* === OVERLAY === */
.agp-gallery-overlay {
	display:none;
    visibility: hidden;
}

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

.agp-overlay-icon {
    display:none;
    visibility: hidden;
}

.agp-overlay-icon svg {
    width: 2rem;
    height: 2rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}

.agp-overlay-text {
    display:none;
    visibility: hidden;
}

/* === LIGHTBOX === */
body.agp-lightbox-open {
    overflow: hidden;
}

.agp-lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
    pointer-events: auto;
}

.agp-lightbox-overlay::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 10, 0.7);
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    z-index: -1;
}

.agp-lightbox-overlay.agp-visible {
    opacity: 1;
}

.agp-lightbox-container {
    position: relative;
    max-width: calc(100vw - 4rem);
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    pointer-events: none;
}

.agp-lightbox-content {
    position: relative;
    background: transparent;
    pointer-events: none;
}

/* ZMĚNA: Rychlý transition na opacity pro plynulé stmívání/rozjasnění */
.agp-lightbox-image {
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    display: block;
    border-radius: 0px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.7);
    opacity: 0; /* Výchozí stav pro první načtení */
    transition: opacity 0.25s ease-out; /* Plynulý náběh */
    pointer-events: auto;
    background: transparent;
	border: 5px solid white;
}

/* === OVLÁDACÍ PRVKY === */
.agp-lightbox-controls {
    pointer-events: none;
}

.agp-lightbox-controls button {
    position: absolute;
    background: rgba(30, 30, 30, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    pointer-events: auto;
}
.agp-lightbox-controls button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.agp-lightbox-close {
    top: -1.75rem;
    right: -1.75rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
    font-weight: 300;
}

.agp-lightbox-prev,
.agp-lightbox-next {
    top: 50%;
    width: 3rem;
    height: 3rem;
}

.agp-lightbox-prev { left: -4rem; }
.agp-lightbox-next { right: -4rem; }

.agp-lightbox-prev svg, .agp-lightbox-next svg {
    width: 1.5rem;
    height: 1.5rem;
}

/* === INFORMAČNÍ PRVKY === */
.agp-lightbox-counter {
    position: absolute;
    top: -2.5rem;
    left: 0;
    color: #ccc;
    font-size: 0.9rem;
}

.agp-lightbox-caption {
    margin-top: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    line-height: 1.5;
    text-align: center;
    max-width: 80vw;
    opacity: 0;
    transform: translateY(1rem);
    transition: all 0.2s ease-in-out 0.1s;
}

.agp-lightbox-caption.agp-visible {
    opacity: 1;
    transform: translateY(0);
}

/* === LOADER === */
.agp-lightbox-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: agp-spin 1s linear infinite;
}

@keyframes agp-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* === VIDEO NÁHLEDY === */
.agp-video-item {
    position: relative;
}

.agp-video-trigger {
    position: relative;
    display: block;
    height: 100%;
}

.agp-video-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.agp-video-item:hover .agp-video-play-icon {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 0.9;
}

.agp-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.agp-video-overlay .agp-overlay-text {
    display: none;
}

/* === VIDEO V LIGHTBOXU === */
.agp-lightbox-video {
    max-width: 100%;
    max-height: calc(100vh - 8rem);
    border-radius: 4px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    outline: none;
    position: relative;
    z-index: 10;
    pointer-events: auto;
}

.agp-lightbox-video::-webkit-media-controls-panel {
    background: transparent;
}

.agp-lightbox-content:hover .agp-lightbox-video {
    pointer-events: auto;
}

.agp-lightbox-overlay .agp-gallery-overlay,
.agp-lightbox-overlay .agp-video-overlay,
.agp-lightbox-content .agp-gallery-overlay,
.agp-lightbox-content .agp-video-overlay {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.agp-lightbox-overlay .agp-gallery-item:hover .agp-gallery-overlay,
.agp-lightbox-overlay .agp-video-item:hover .agp-video-overlay {
    display: none !important;
    opacity: 0 !important;
}

/* === RESPONZIVNÍ DESIGN === */
@media (max-width: 900px) {
    .agp-lightbox-prev { left: 0.5rem; }
    .agp-lightbox-next { right: 0.5rem; }
    .agp-lightbox-close { top: 0.5rem; right: 0.5rem; background: rgba(10,10,10,0.8); }
    .agp-lightbox-container { max-width: 100vw; max-height: 100vh; }
    .agp-lightbox-image { max-height: calc(100vh - 6rem); border-radius: 0; }
    .agp-lightbox-video { max-height: calc(100vh - 6rem); border-radius: 0; }
}

@media (max-width: 768px) {
    .agp-gallery-grid {
        justify-content: center;
    }

    .agp-video-play-icon {
        width: 48px;
        height: 48px;
    }
}