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

body { 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    line-height: 1.6; 
    color: #333; 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    min-height: 100vh;
    position: relative;
}

.main-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 1200px;
    width: 100%;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
}

/* Advertisement Styles */
.ad-container {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
}

.ad-left {
    left: 20px;
}

.ad-right {
    right: 20px;
}

.ad-bottom {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    border-top: 2px solid #e9ecef;
}

.ad-banner {
    margin: 20px 0;
    display: flex;
    justify-content: center;
}

.ad-in-content {
    margin: 30px 0;
    display: flex;
    justify-content: center;
}

.footer-ad {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.ad-placeholder {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border: 2px dashed #dee2e6;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

.ad-placeholder:hover {
    border-color: #007bff;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
}

.ad-label {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: #6c757d;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: bold;
}

.ad-content {
    color: #6c757d;
    font-size: 14px;
}

.ad-content p {
    margin: 5px 0;
}

/* Left and Right Ads */
.ad-left .ad-placeholder,
.ad-right .ad-placeholder {
    width: 160px;
    height: 600px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.ad-banner .ad-placeholder {
    width: 728px;
    height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-in-content .ad-placeholder {
    width: 300px;
    height: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.footer-ad .ad-placeholder {
    width: 728px;
    height: 90px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ad-bottom .ad-placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: none;
    border-radius: 0;
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #ff0000, #cc0000);
    color: white;
    text-align: center;
    padding: 40px 20px;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

/* Main Content Styles */
main {
    padding: 40px 20px;
}

.input-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px dashed #dee2e6;
}

.input-group {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#videoUrl {
    flex: 1;
    min-width: 300px;
    padding: 15px 20px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

#videoUrl:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

#fetchBtn {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

#fetchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,123,255,0.3);
}

#fetchBtn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.examples {
    text-align: center;
}

.examples p {
    margin-bottom: 10px;
    color: #6c757d;
}

.examples code {
    background: #e9ecef;
    padding: 5px 10px;
    border-radius: 5px;
    margin: 0 5px;
    font-family: monospace;
    color: #495057;
}

.loading {
    text-align: center;
    padding: 40px;
    display: none;
}

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

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

.error {
    background: #f8d7da;
    color: #721c24;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #f5c6cb;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.results {
    margin-top: 30px;
    display: none;
}

.results h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.thumbnail-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

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

.thumbnail-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid #e9ecef;
}

.thumbnail-info {
    padding: 15px;
}

.quality-badge {
    display: inline-block;
    background: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
}

.download-btn {
    width: 100%;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.download-btn:hover {
    background: linear-gradient(135deg, #218838, #1e9e7f);
    transform: translateY(-2px);
}

.instructions {
    background: #e7f3ff;
    padding: 25px;
    border-radius: 15px;
    border-left: 5px solid #007bff;
}

.instructions h3 {
    color: #007bff;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.instructions ol {
    margin-left: 20px;
}

.instructions li {
    margin-bottom: 8px;
}

footer {
    background: #f8f9fa;
    text-align: center;
    padding: 20px;
    color: #6c757d;
    border-top: 1px solid #e9ecef;
}

/* SEO Optimization Styles */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #007bff;
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Introduction Section */
.intro-section {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    margin-bottom: 30px;
    border-left: 5px solid #28a745;
}

.intro-content {
    max-width: 800px;
    margin: 0 auto;
}

.feature-list {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-top: 20px;
    border: 1px solid #e9ecef;
}

.feature-list h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.feature-list ul {
    list-style: none;
    padding: 0;
}

.feature-list li {
    padding: 8px 0;
    border-bottom: 1px solid #f8f9fa;
}

/* FAQ Section */
.faq-section {
    background: #fff;
    padding: 40px 30px;
    border-radius: 15px;
    margin: 40px 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.faq-section h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.faq-item {
    margin-bottom: 25px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e9ecef;
}

.faq-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.faq-item h3 {
    color: #007bff;
    margin-bottom: 10px;
    font-size: 1.2em;
}

.faq-item p {
    color: #666;
    line-height: 1.6;
}

/* Related Tools */
.related-tools {
    margin: 40px 0;
}

.related-tools h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2em;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.tool-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
    border: 1px solid #e9ecef;
}

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

.tool-card h3 {
    color: #007bff;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.tool-card p {
    color: #666;
    font-size: 0.95em;
}

/* Footer Links */
.footer-content {
    padding: 20px 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #6c757d;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #007bff;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ad-left,
    .ad-right {
        display: none;
    }
    
    .ad-bottom {
        display: block;
    }
    
    .main-container {
        padding: 10px;
    }
}

@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
    }
    
    #videoUrl {
        min-width: auto;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    .thumbnails-grid {
        grid-template-columns: 1fr;
    }
    
    .ad-banner .ad-placeholder,
    .footer-ad .ad-placeholder {
        width: 100%;
        max-width: 320px;
        height: 100px;
    }
    
    .ad-in-content .ad-placeholder {
        width: 100%;
        max-width: 300px;
        height: 250px;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0;
    }
    
    .container {
        border-radius: 10px;
    }
    
    main {
        padding: 20px 15px;
    }
    
    .input-section {
        padding: 20px;
    }
    
    .ad-bottom .ad-placeholder {
        height: 80px;
    }
    
    .ad-content {
        font-size: 12px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
}

/* Print Styles */
@media print {
    .ad-container,
    .ad-banner,
    .ad-in-content,
    .footer-ad {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}