:root {
    --primary: #e63946;
    --primary-dark: #d32f2f;
    --secondary: #1d3557;
    --light: #f8f9fa;
    --dark: #212529;
    --gray: #6c757d;
    --border-radius: 8px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--secondary);
}

.logo img {
    width: 40px;
    height: 40px;
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    text-decoration: none;
    color: var(--dark);
    font-weight: 500;
    transition: color 0.3s;
}

nav a:hover {
    color: var(--primary);
}

/* Hero Section */
.hero {
    padding: 80px 20px;
    text-align: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    font-weight: 800;
}

.subtitle {
    font-size: 1.2rem;
    margin-bottom: 40px;
    opacity: 0.9;
}

.download-box {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 800px;
    margin: 0 auto;
}

.input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#youtube-url {
    flex: 1;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: border-color 0.3s;
}

#youtube-url:focus {
    outline: none;
    border-color: var(--primary);
}

#fetch-btn, #download-btn, .secondary-button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
    white-space: nowrap;
}

#fetch-btn:hover, #download-btn:hover {
    background: var(--primary-dark);
}

.secondary-button {
    background: var(--secondary);
}

.secondary-button:hover {
    background: #152642;
}

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.message {
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    font-weight: 500;
}

.message.error {
    background: #ffe6e6;
    color: #d32f2f;
    border: 1px solid #ffcdd2;
}

.message.success {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #a8dab5;
}

/* Preview Container */
.preview-container {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eaeaea;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-container h3 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--secondary);
}

.thumbnail-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

#thumbnail-image {
    max-width: 100%;
    max-height: 400px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    border: 3px solid white;
    transition: transform 0.3s;
}

#thumbnail-image:hover {
    transform: scale(1.02);
}

.thumbnail-info {
    text-align: center;
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 500px;
}

.thumbnail-info p {
    margin: 5px 0;
    color: var(--dark);
}

.preview-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* How It Works */
.how-it-works {
    padding: 80px 20px;
    background: white;
}

.how-it-works h2 {
    text-align: center;
    margin-bottom: 50px;
    color: var(--secondary);
    font-size: 2.5rem;
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.step {
    text-align: center;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: transform 0.3s;
}

.step:hover {
    transform: translateY(-5px);
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin: 0 auto 20px;
}

.step h3 {
    margin-bottom: 15px;
    color: var(--secondary);
}

/* Description */
.description {
    padding: 80px 20px;
    background: #f8f9fa;
}

.description h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--secondary);
}

.description p {
    margin-bottom: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Footer */
footer {
    background: var(--secondary);
    color: white;
    padding: 50px 20px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
}

.footer-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 0.8;
}

.copyright {
    text-align: center;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    #fetch-btn, #download-btn, .secondary-button {
        width: 100%;
    }
    
    header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .preview-actions {
        flex-direction: column;
    }
    
    .preview-actions button {
        width: 100%;
    }
    
    .thumbnail-preview {
        flex-direction: column;
    }
}