
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: rgb(0, 0, 0);
    min-height: 100vh;
    display: flex;
    flex-direction: column; /* Changed to column layout */
}

.grid-container {
    width: 80%;
    flex: 1; /* Takes available space */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    background-color: white;
    background-image: 
        linear-gradient(to right, black 1px, transparent 1px),
        linear-gradient(to bottom, black 1px, transparent 1px);
    background-size: 20px 20px;
    padding: 20px;
    border: 2px solid black;
    margin: 0 auto; /* Center horizontally */ 
    margin-top: 120px; 
    margin-bottom: 45px;
}

.video-item {
    position: relative;
    aspect-ratio: 16/9;
    border: 3px solid black;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    transition: all 0.3s ease;
}

.video-item::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    background: linear-gradient(45deg, 
        #ff0000, #ff4500, #ffa500, #ffff00, #adff2f, #00ff00, 
        #00ffff, #0080ff, #0000ff, #4b0082, #8b00ff, #ff00ff, 
        #ff1493, #ff69b4, #ff0000);
    background-size: 300% 300%;
    border-radius: inherit;
    opacity: 0;
    z-index: -1;
    animation: rgb-rainbow 4s linear infinite;
    transition: opacity 0.5s ease;
}

.video-item:hover::before,
.video-item.active::before {
    opacity: 1;
    animation: rgb-rainbow 2s linear infinite;
}

.video-item iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: relative;
    z-index: 1;
}

@keyframes rgb-rainbow {
    0% { 
        background-position: 0% 50%;
        filter: hue-rotate(0deg);
    }
    25% { 
        background-position: 100% 25%;
        filter: hue-rotate(90deg);
    }
    50% { 
        background-position: 100% 100%;
        filter: hue-rotate(180deg);
    }
    75% { 
        background-position: 0% 75%;
        filter: hue-rotate(270deg);
    }
    100% { 
        background-position: 0% 50%;
        filter: hue-rotate(360deg);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .grid-container {
        width: 95%;
        height: 90vh;
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
        gap: 15px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 10px;
    }
}
