/* Basic body styling */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #1c1e21;
    margin: 0;
    padding: 20px;
}

h1, h2 {
    text-align: center;
    color: #333;
}

/* Search form styling */
.search-form {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.search-form input[type="text"] {
    font-size: 1.2em;
    padding: 10px 15px;
    width: 400px;
    max-width: 70%;
    border: 1px solid #ddd;
    border-radius: 20px 0 0 20px;
}

.search-form button {
    font-size: 1.2em;
    padding: 10px 20px;
    border: none;
    background-color: #0d6efd;
    color: white;
    cursor: pointer;
    border-radius: 0 20px 20px 0;
}

/* Grid for thumbnails */
.thumbnail-grid {
    display: grid;
    /* This creates a responsive grid: */
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Individual video card */
.video-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease;
}

.video-card:hover {
    transform: translateY(-5px);
}

.video-card a {
    text-decoration: none;
    color: inherit;
}

.video-card img {
    width: 100%;
    height: auto;
    display: block;
}

.video-card .video-title {
    font-weight: 600;
    font-size: 0.9em;
    padding: 10px 12px 5px 12px;
    /* Clamp text to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-card .video-views {
    font-size: 0.8em;
    color: #606770;
    padding: 0 12px 10px 12px;
    margin: 0;
}

/* Flash message styling */
.flash-messages {
    width: 100%;
    max-width: 600px;
    margin: 0 auto 20px auto;
}

.flash-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 10px 15px;
    border-radius: 8px;
    text-align: center;
}

/* Loader for AJAX search */
.loader {
    border: 8px solid #f3f3f3; /* Light grey */
    border-top: 8px solid #0d6efd; /* Blue */
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 40px auto;
}

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