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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #ffffff;
    overflow-x: hidden;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem 0;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    z-index: 0;
}

.header .container {
    position: relative;
    z-index: 1;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.logo h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.tagline {
    font-size: 1.125rem;
    font-weight: 400;
    opacity: 0.9;
}

/* Main Content */
.main {
    padding: 4rem 0;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 4rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #1a202c;
    letter-spacing: -0.02em;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: #718096;
    margin-bottom: 2.5rem;
    font-weight: 400;
}

/* Download Form */
.download-form {
    max-width: 600px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.input-group input {
    flex: 1;
    min-width: 300px;
    padding: 1rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #ffffff;
}

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

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

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

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

.error-message {
    color: #e53e3e;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: rgba(229, 62, 62, 0.1);
    border-radius: 8px;
    display: none;
}

/* Output Section */
.output-section {
    background: #f7fafc;
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 4rem;
    border: 1px solid #e2e8f0;
    animation: fadeInUp 0.5s ease;
}

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

.video-info {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: flex-start;
}

.video-thumbnail {
    flex-shrink: 0;
}

.video-thumbnail img {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.video-details h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #1a202c;
}

.video-details p {
    color: #718096;
    margin-bottom: 0.25rem;
}

.download-options h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #1a202c;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.option-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.option-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.option-card svg {
    color: #667eea;
    margin-bottom: 1rem;
}

.option-card h5 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1a202c;
}

.quality-options {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.quality-btn {
    padding: 0.5rem 1rem;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #4a5568;
}

.quality-btn:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Service Notice */
.service-notice {
    background: linear-gradient(135deg, #e6fffa 0%, #b2f5ea 100%);
    border: 1px solid #4fd1c7;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1.5rem;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.service-notice p {
    margin: 0;
    color: #234e52;
    font-size: 0.875rem;
    font-weight: 500;
}

/* FAQ Section */
.faq-section {
    margin-bottom: 4rem;
}

.faq-section h3 {
    font-size: 2rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2rem;
    color: #1a202c;
}

.faq-container {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.faq-question {
    width: 100%;
    padding: 1.5rem;
    background: white;
    border: none;
    text-align: left;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    color: #1a202c;
}

.faq-question:hover {
    background: #f7fafc;
}

.faq-question svg {
    transition: transform 0.3s ease;
}

.faq-question[aria-expanded="true"] svg {
    transform: rotate(180deg);
}

.faq-answer {
    padding: 0 1.5rem;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-answer.open {
    max-height: 200px;
    padding: 0 1.5rem 1.5rem;
}

.faq-answer p {
    color: #718096;
    line-height: 1.6;
}

/* Footer */
.footer {
    background: #1a202c;
    color: white;
    padding: 2rem 0 1rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 2rem;
}

.disclaimer {
    flex: 1;
}

.disclaimer p {
    font-size: 0.875rem;
    line-height: 1.6;
    opacity: 0.9;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #667eea;
}

.footer-bottom {
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid #2d3748;
}

.footer-bottom p {
    font-size: 0.875rem;
    opacity: 0.7;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

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

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

.loading-overlay p {
    color: white;
    font-size: 1.125rem;
    font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .header {
        padding: 1.5rem 0;
    }
    
    .logo h1 {
        font-size: 1.75rem;
    }
    
    .tagline {
        font-size: 1rem;
    }
    
    .main {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .input-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .input-group input {
        min-width: unset;
    }
    
    .download-btn {
        justify-content: center;
    }
    
    .video-info {
        flex-direction: column;
        gap: 1rem;
    }
    
    .video-thumbnail {
        align-self: center;
    }
    
    .options-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .footer-links {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .input-group input {
        padding: 0.875rem 1rem;
    }
    
    .download-btn {
        padding: 0.875rem 1.5rem;
    }
    
    .output-section {
        padding: 1.5rem;
    }
    
    .option-card {
        padding: 1rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

button:focus,
input:focus,
a:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Download Interface Styles */
.download-interface {
    background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
    border: 2px solid #48bb78;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    animation: slideIn 0.3s ease;
}

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

.download-status {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.download-icon {
    flex-shrink: 0;
}

.download-info h4 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #22543d;
    margin-bottom: 0.25rem;
}

.download-info p {
    color: #38a169;
    font-size: 0.875rem;
    font-weight: 500;
}

.download-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.countdown-display {
    text-align: center;
    padding: 0.75rem;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 8px;
}

.countdown-display span {
    color: #22543d;
    font-weight: 500;
}

.countdown-display strong {
    color: #38a169;
    font-size: 1.125rem;
}

.download-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.download-now-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: #48bb78;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.download-now-btn:hover {
    background: #38a169;
    transform: translateY(-1px);
}

.cancel-btn {
    padding: 0.75rem 1.5rem;
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.cancel-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.download-success {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.download-success svg {
    width: 48px;
    height: 48px;
}

.download-success h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #22543d;
    margin: 0;
}

.download-success p {
    color: #38a169;
    margin: 0;
}

.download-again-btn {
    padding: 0.5rem 1rem;
    background: #e6fffa;
    color: #38a169;
    border: 1px solid #48bb78;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.download-again-btn:hover {
    background: #48bb78;
    color: white;
}

/* API Key Warning */
.api-key-warning {
    background: #fef5e7;
    border: 2px solid #ed8936;
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
}

.api-key-warning h4 {
    color: #c05621;
    margin-bottom: 0.5rem;
}

.api-key-warning p {
    color: #9c4221;
    margin-bottom: 1rem;
}

.api-key-warning button {
    background: #ed8936;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.api-key-warning button:hover {
    background: #dd6b20;
}

/* Responsive Design for Download Interface */
@media (max-width: 768px) {
    .download-buttons {
        flex-direction: column;
    }
    
    .download-now-btn,
    .cancel-btn {
        width: 100%;
        justify-content: center;
    }
    
    .download-status {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .header {
        background: #000;
        color: #fff;
    }
    
    .download-btn {
        background: #000;
        border: 2px solid #fff;
    }
    
    .option-card {
        border: 2px solid #000;
    }
    
    .download-interface {
        border: 2px solid #000;
        background: #fff;
    }
}
