/* --- SEKCJA 2: VIDEO --- */
.section-video {
    background: #000;
    position: relative;
}

.video-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.7;
    /* Increased brightness from 0.4 */
    transition: opacity 0.8s ease;
}

video.active {
    opacity: 1;
}

/* STICKY VIDEO CLASS (TECH FLAT DESIGN) */
.video-sticky {
    position: fixed !important;
    top: 30px !important;
    right: 30px !important;
    left: auto !important;
    bottom: auto !important;
    width: 360px !important;
    height: 202px !important;
    z-index: 9999;
    border: 4px solid #fff;
    background: #000;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    transform: translateY(20px);
    animation: stickyPopIn 0.5s forwards cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes stickyPopIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Video Caption */
.video-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    padding: 5px 10px;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.video-sticky .video-caption {
    opacity: 1;
}

/* Sticky Controls */
.sticky-controls {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    gap: 10px;
    z-index: 20;
}

.video-sticky .sticky-controls {
    display: flex;
}

.sticky-btn {
    width: 30px;
    height: 30px;
    background: #000;
    border: 1px solid #fff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Space Mono', monospace;
    font-size: 12px;
}

.sticky-btn:hover {
    background: #fff;
    color: #000;
}

/* Sticky Label CTA */
.sticky-label-cta {
    position: absolute;
    top: 50%;
    left: -160px;
    transform: translateY(-50%);
    background: #fff;
    color: #000;
    padding: 10px 20px;
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 100;
    /* Ensure it's above the video border/shadow */
}

.video-sticky .sticky-label-cta {
    display: flex;
    animation: labelBounce 2s infinite;
}

@keyframes labelBounce {

    0%,
    100% {
        transform: translateY(-50%) translateX(0);
    }

    50% {
        transform: translateY(-50%) translateX(-10px);
    }
}

/* Hide elements in sticky mode */
.video-sticky .play-container,
.video-sticky .overlay {
    display: none !important;
}

/* Sticky Play Button */
.sticky-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #fff;
    border-radius: 50%;
    display: none;
    /* Hidden by default */
    justify-content: center;
    align-items: center;
    cursor: pointer;
    z-index: 20;
    transition: transform 0.3s ease, background 0.3s ease;
}

/* Only show when sticky */
.video-sticky .sticky-play-btn {
    display: flex;
}

.sticky-play-btn svg {
    width: 24px;
    height: 24px;
    fill: #fff;
    margin-left: 4px;
    /* Optical center */
}

.sticky-play-btn:hover {
    transform: translate(-50%, -50%) scale(1.1);
    background: var(--c-accent);
    border-color: var(--c-accent);
}

/* Always show play button in sticky mode, or just when paused? 
   User said "Mini video ma dostac play icon na srodku" (Mini video must get play icon in the middle).
   I will make it always visible in sticky mode for now to satisfy "must get". 
   Or better: visible but maybe different icon if playing? 
   Let's stick to the requested "play icon". */
.video-sticky .sticky-play-btn {
    display: flex;
}

/* FLASHLIGHT OVERLAY */
.flashlight-overlay {
    position: absolute;
    inset: 0;
    background: #000;
    opacity: 0.3;
    /* Reduced opacity from 0.6 */
    pointer-events: none;
    z-index: 5;
    transition: opacity 0.5s ease;
}

.video-active .flashlight-overlay {
    opacity: 0;
}

/* Formula Overlay on Video */
.video-formula-overlay {
    position: absolute;
    top: 30px;
    left: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 1.5rem;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    z-index: 10;
    transition: all 0.3s ease;
    cursor: help;
    opacity: 1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.video-sticky .video-formula-overlay {
    opacity: 0;
    pointer-events: none;
}

.video-formula-overlay:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.formula-mini-math {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 1.2rem;
}

.f-left {
    display: flex;
    align-items: baseline;
}

.f-sup {
    font-size: 0.7em;
    vertical-align: super;
    margin-left: 2px;
}

.f-fraction {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 5px;
}

.f-num {
    border-bottom: 1px solid #fff;
    padding-bottom: 2px;
    margin-bottom: 2px;
    line-height: 1;
}

.f-den {
    line-height: 1;
}

.math-mini-desc {
    font-size: 0.6rem;
    opacity: 0.8;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
    padding-left: 15px;
    height: 30px;
    display: flex;
    align-items: center;
}

/* PLAY BUTTON */
.play-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    cursor: pointer;
    transition: all 0.5s ease;
}

.play-circle-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    z-index: 2;
}

.play-pulse {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 1px solid var(--c-accent);
    opacity: 0;
    z-index: 1;
    animation: pulse-ring 2.5s infinite;
}

@keyframes pulse-ring {
    0% {
        width: 100%;
        height: 100%;
        opacity: 0.5;
    }

    100% {
        width: 180%;
        height: 180%;
        opacity: 0;
    }
}

.play-container:hover .play-circle {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--c-accent);
    transform: scale(1.1);
}

.play-icon {
    width: 30px;
    height: 30px;
    fill: var(--c-white);
    transform: translateX(2px);
    transition: fill 0.3s ease;
}

.play-container:hover .play-icon {
    fill: var(--c-accent);
}

.play-label {
    font-family: 'Space Mono', monospace;
    font-size: 0.9rem;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--c-white);
    opacity: 0.8;
    transition: opacity 0.3s;
}

.play-container.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.8);
}

@media (max-width: 768px) {
    .video-sticky {
        width: 200px !important;
        height: 112px !important;
        top: auto !important;
        bottom: 20px !important;
        right: 20px !important;
        border-width: 2px;
    }

    .sticky-label-cta {
        display: none !important;
    }

    .video-formula-overlay {
        transform: scale(0.8);
        transform-origin: top left;
        top: 20px;
        left: 20px;
    }
}