/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    padding: 40px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.logo-icon {
    font-size: 3em;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.logo-text {
    font-size: 2.5em;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    color: #666;
    font-size: 1.1em;
}

/* Search Section */
.search-section {
    margin-bottom: 40px;
}

.search-container {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.search-input {
    flex: 1;
    padding: 16px 20px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    transition: all 0.3s ease;
    outline: none;
}

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

.search-btn {
    padding: 16px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.search-btn:active {
    transform: translateY(0);
}

.search-icon {
    font-size: 1.2em;
}

.search-hint {
    color: #999;
    font-size: 0.9em;
    text-align: center;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: #667eea;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

/* Search Results */
.search-results {
    margin-bottom: 40px;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

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

.result-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.result-thumbnail {
    width: 100%;
    height: 160px;
    object-fit: cover;
    background: #e0e0e0;
}

.result-info {
    padding: 15px;
}

.result-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: #333;
}

.result-channel {
    color: #666;
    font-size: 13px;
    margin-bottom: 5px;
}

.result-meta {
    color: #999;
    font-size: 12px;
    display: flex;
    gap: 10px;
}

/* Video Info */
.video-info {
    margin-bottom: 40px;
}

.video-details {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 30px;
    margin-bottom: 30px;
}

.video-thumbnail-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

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

.video-duration {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.video-metadata {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.video-title {
    font-size: 1.8em;
    font-weight: 700;
    color: #333;
    line-height: 1.3;
}

.video-channel {
    display: flex;
    align-items: center;
    gap: 10px;
}

.channel-name {
    font-size: 1.1em;
    color: #667eea;
    font-weight: 600;
}

.video-stats {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.stat-item {
    color: #666;
    font-size: 0.95em;
}

.stat-item::before {
    margin-right: 5px;
}

/* Download Section */
.download-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.5em;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
}

.format-selector {
    margin-bottom: 20px;
}

.format-label {
    display: block;
    font-weight: 600;
    color: #555;
    margin-bottom: 10px;
}

.quality-select {
    width: 100%;
    padding: 14px;
    font-size: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quality-select:focus {
    outline: none;
    border-color: #667eea;
}

.download-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.btn {
    flex: 1;
    min-width: 200px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #28a745;
    color: white;
}

.btn-secondary:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(40, 167, 69, 0.3);
}

.btn-tertiary {
    background: #6c757d;
    color: white;
}

.btn-tertiary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 1.2em;
}

.download-info {
    padding: 15px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
}

.info-text {
    margin: 0;
    font-size: 14px;
}

/* Video Description */
.video-description-section {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 12px;
}

.video-description {
    color: #555;
    font-size: 14px;
    line-height: 1.8;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

/* Loading */
.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Error Message */
.error-message {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.error-icon {
    font-size: 1.5em;
}

/* Footer */
.footer {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
    text-align: center;
    color: #666;
}

.footer p {
    margin-bottom: 10px;
}

.footer-links {
    margin-top: 15px;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #764ba2;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    .logo-text {
        font-size: 1.8em;
    }

    .search-container {
        flex-direction: column;
    }

    .search-btn {
        width: 100%;
        justify-content: center;
    }

    .video-details {
        grid-template-columns: 1fr;
    }

    .results-grid {
        grid-template-columns: 1fr;
    }

    .download-buttons {
        flex-direction: column;
    }

    .btn {
        min-width: auto;
        width: 100%;
    }

    .video-title {
        font-size: 1.4em;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        border-radius: 12px;
    }

    .logo-icon {
        font-size: 2em;
    }

    .logo-text {
        font-size: 1.5em;
    }

    .tagline {
        font-size: 0.9em;
    }
}
