* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header Styles */
.header {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 20px;
}

.stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    flex-wrap: wrap;
}

.stat-item {
    background: #f8f9fa;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1em;
    color: #333;
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.search-box,
.filter-select {
    flex: 1;
    min-width: 250px;
    padding: 15px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    background: white;
}

.search-box:focus,
.filter-select:focus {
    outline: none;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

/* Video Grid */
.video-grid {
    margin-bottom: 30px;
}

/* Category Sections */
.category-section {
    margin-bottom: 50px;
}

.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 15px 25px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.1);
}

.category-title {
    font-size: 1.8em;
    color: #667eea;
    margin: 0;
    font-weight: 700;
}

.category-count {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

.video-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    position: relative;
    height: 380px;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
}

.video-thumbnail {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.video-thumbnail::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><text y="50" font-size="50" fill="white" opacity="0.1">▶</text></svg>') center/40% no-repeat;
}

.play-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #667eea;
    z-index: 1;
}

.video-info {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.task-id {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: bold;
    margin-bottom: 10px;
}

.video-title {
    font-size: 1.1em;
    color: #333;
    margin-bottom: 10px;
    font-weight: 600;
    line-height: 1.4;
    height: 52px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-description {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 67px;
    flex-shrink: 0;
}

.category-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.95);
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.75em;
    font-weight: bold;
    color: #667eea;
    z-index: 2;
}

.serial-number {
    position: absolute;
    top: 10px;
    left: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 14px;
    border-radius: 50%;
    font-size: 0.9em;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    position: relative;
    background-color: white;
    margin: 2% auto;
    padding: 0;
    width: 90%;
    max-width: 1200px;
    border-radius: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    color: #666;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #667eea;
}

.modal-body {
    padding: 20px;
}

#modalIframe {
    width: 100%;
    height: 600px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.modal-info h2 {
    color: #667eea;
    margin-bottom: 10px;
}

#modalTaskId {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: bold;
    margin-bottom: 15px;
}

#modalDescription {
    color: #666;
    line-height: 1.6;
    font-size: 1.05em;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header h1 {
        font-size: 1.8em;
    }

    .category-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }

    .category-title {
        font-size: 1.4em;
    }

    .category-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .controls {
        flex-direction: column;
    }

    .search-box,
    .filter-select {
        width: 100%;
    }

    #modalIframe {
        height: 300px;
    }

    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
}

/* Loading Animation */
.loading {
    text-align: center;
    padding: 50px;
    color: white;
    font-size: 1.5em;
}

.loading::after {
    content: '...';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* No Results */
.no-results {
    text-align: center;
    padding: 50px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.no-results h2 {
    color: #667eea;
    margin-bottom: 10px;
}

.no-results p {
    color: #666;
}
