/* General Body Styles */
body {
    font-family: 'Roboto', sans-serif;
    margin: 0;
    background-color: #f0f2f5;
    color: #333;
}

/* Header and Search Bar */
header {
    background-color: #ffffff;
    padding: 20px 40px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

header h1 {
    margin: 0 0 15px 0;
    color: #1c1e21;
}

.search-container {
    display: flex;
    justify-content: center;
    max-width: 600px;
    margin: 0 auto;
}

#searchInput {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dddfe2;
    border-radius: 6px 0 0 6px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}

#searchInput:focus {
    border-color: #1877f2;
}

#searchButton {
    padding: 12px 25px;
    border: none;
    background-color: #1877f2;
    color: white;
    font-size: 16px;
    font-weight: 500;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    transition: background-color 0.2s;
}

#searchButton:hover {
    background-color: #166fe5;
}

/* Video Grid Layout */
main {
    padding: 30px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

/* Individual Video Card */
.video-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s, box-shadow 0.2s;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.thumbnail-container {
    position: relative;
    cursor: pointer;
}

.thumbnail {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
}

.play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-top: 12px solid transparent;
    border-bottom: 12px solid transparent;
    border-left: 20px solid white;
    margin-left: 5px;
}

.thumbnail-container:hover .play-icon {
    background-color: rgba(24, 119, 242, 0.8);
    transform: translate(-50%, -50%) scale(1.1);
}

.video-info {
    padding: 15px;
    font-size: 14px;
    color: #606770;
}

.video-info a {
    text-decoration: none;
    color: #1877f2;
    font-weight: 500;
}

.video-info a:hover {
    text-decoration: underline;
}


/* Video Modal (Lightbox) */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.85);
    align-items: center;
    justify-content: center;
}

.modal-content {
    position: relative;
    width: 90%;
    max-width: 960px;
}

#modal-video-player {
    width: 100%;
    max-height: 90vh;
    outline: none;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s;
}

.close-button:hover,
.close-button:focus {
    color: #bbb;
}

/* Loading Spinner */
.loader {
    border: 8px solid #f3f3f3;
    border-radius: 50%;
    border-top: 8px solid #1877f2;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}