/* === Reset & Base === */
html, body {
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* Prevent horizontal scroll */
    background-color: #121212;
    color: #ddd;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
}

body {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px 40px;
    box-sizing: border-box;
}

/* Header */
header {
    background-color: #1e1e1e;
    padding: 15px 20px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
    position: sticky;
    top: 0;
    z-index: 9999;
}

header h1 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    color: #ff5722;
    text-align: right;
}

/* Links */
a {
    color: #ff5722;
    text-decoration: none;
    transition: color 0.3s ease;
    outline-offset: 2px;
}

a:hover,
a:focus {
    color: #ff784e;
    outline: none;
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

/* Video Card */
.video-card {
    background: #222;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.7);
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94), box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.video-card:hover,
.video-card:focus-within {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(255, 87, 34, 0.6);
    outline: none;
}

/* Thumbnail Container */
.video-thumb-container {
    overflow: hidden;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
    height: 140px;
    position: relative;
    background: #333;
}

/* Responsive Thumbnail */
.video-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.video-card:hover .video-thumb,
.video-card:focus-within .video-thumb {
    transform: scale(1.05);
}

/* Video Title */
.video-title {
    color: #eee;
    font-size: 1rem;
    margin: 12px 12px 15px 12px;
    text-align: right;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.2em;
    max-height: 2.4em;
}

/* Pagination */
.pagination {
    margin: 40px 0;
    text-align: center;
    font-family: Arial, sans-serif;
    user-select: none;
}

.pagination a, 
.pagination span.current {
    display: inline-block;
    padding: 10px 16px;
    margin: 0 5px;
    background: #333;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    min-width: 38px;
    text-align: center;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

.pagination span.current {
    background: #ff5722;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(255, 87, 34, 0.8);
}

.pagination a:hover,
.pagination a:focus {
    background: #444;
    transform: translateY(-3px);
    outline: none;
}

/* No videos message */
.no-videos {
    background: #2a2a2a;
    padding: 60px 20px;
    border-radius: 10px;
    text-align: center;
    color: #bbb;
    font-size: 1.25rem;
}

/* Responsive tweaks */
@media (max-width: 768px) {
    .video-thumb-container {
        height: 120px;
    }
    .video-title {
        font-size: 0.9rem;
        max-height: 2.2em;
    }
    .container {
        padding: 0 12px 30px;
        max-width: 100vw;
    }
    header h1 {
        font-size: 1.4rem;
    }
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
}

@media (max-width: 480px) {
    .video-thumb-container {
        height: 110px;
    }
    .video-title {
        font-size: 0.85rem;
    }
    .container {
        padding: 0 10px 25px;
    }
    header h1 {
        font-size: 1.2rem;
    }
}

/* Prevent horizontal scroll caused by any oversized elements */
* {
    max-width: 100vw;
    box-sizing: border-box;
}
