* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.3);
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    border-bottom: 4px solid #667eea;
}

.header-content h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
}

.header-content p.subtitle {
    font-size: 1.1em;
    opacity: 0.95;
    margin-bottom: 15px;
}

.header-stats {
    font-size: 0.95em;
    opacity: 0.9;
    margin-top: 10px;
}

/* Search Section */
.search-section {
    position: relative;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.search-box {
    width: 100%;
    max-width: 600px;
    display: block;
    margin: 0 auto;
    padding: 12px 20px;
    font-size: 1em;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    transition: all 0.3s ease;
}

.search-box:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-results {
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.search-result-item-category {
    font-size: 0.85em;
    color: #999;
    margin-top: 4px;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: #f8f9fa;
    border-right: 1px solid #e9ecef;
    padding: 20px;
    overflow-y: auto;
    min-height: 500px;
}

.sidebar h2 {
    font-size: 1.3em;
    margin-bottom: 20px;
    color: #333;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-item {
    padding: 12px 16px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95em;
}

.category-item:hover {
    border-color: #667eea;
    background: #f0f4ff;
}

.category-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
    font-weight: 600;
}

.category-count {
    font-size: 0.85em;
    opacity: 0.7;
    margin-left: 8px;
}

.loading {
    color: #999;
    text-align: center;
    padding: 20px;
    font-size: 0.95em;
}

/* Videos Section */
.videos-section {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    background: white;
}

.welcome-message {
    text-align: center;
    padding: 80px 20px;
    color: #999;
    font-size: 1.2em;
}

.videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.video-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    border-color: #667eea;
}

.video-thumbnail {
    width: 100%;
    height: 120px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: white;
    position: relative;
    overflow: hidden;
}

.video-thumbnail::after {
    content: '▶';
    position: absolute;
    font-size: 2em;
    opacity: 0.8;
}

.video-info p {
    padding: 12px;
    font-size: 0.9em;
    line-height: 1.4;
    word-break: break-word;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 2em;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #333;
}

#modalVideo {
    width: 100%;
    height: auto;
    max-height: 500px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.video-info {
    margin-top: 20px;
}

.video-info h3 {
    margin-bottom: 15px;
    color: #333;
    word-break: break-word;
}

/* Buttons */
.share-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95em;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.share-url {
    margin-top: 15px;
    padding: 12px;
    background: #f0f4ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    word-break: break-all;
    font-family: monospace;
    font-size: 0.85em;
    color: #333;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #333;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    font-size: 0.95em;
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.3s ease;
    z-index: 2000;
    max-width: 300px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

/* Responsive Design */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e9ecef;
        max-height: 200px;
        overflow-x: auto;
    }

    .category-list {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .category-item {
        flex: 0 1 calc(50% - 4px);
        padding: 8px 12px;
        font-size: 0.85em;
    }

    .videos-section {
        padding: 20px;
    }

    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .header-content h1 {
        font-size: 1.8em;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }

    #modalVideo {
        max-height: 300px;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 20px 10px;
    }

    .header-content h1 {
        font-size: 1.5em;
    }

    .videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .sidebar {
        max-height: 150px;
    }

    .modal-content {
        padding: 15px;
    }

    .toast {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}
