/* Design System Variables */
:root {
    --background: hsl(0, 0%, 4%);
    --foreground: hsl(0, 0%, 100%);
    --card: hsl(240, 10%, 8%);
    --card-foreground: hsl(0, 0%, 98%);
    --primary: hsl(76, 91%, 50%);
    --primary-foreground: hsl(0, 0%, 0%);
    --primary-glow: hsl(76, 91%, 50%);
    --secondary: hsl(76, 91%, 50%);
    --secondary-glow: hsl(76, 91%, 50%);
    --secondary-foreground: hsl(0, 0%, 100%);
    --muted: hsl(0, 0%, 90%);
    --muted-foreground: hsl(0, 0%, 100%);
    --accent: hsl(76, 91%, 50%);
    --border: hsl(76, 91%, 50%);
    --input: hsl(0, 0%, 100%);
    --radius: 30px;
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Background Mesh */
.background-mesh {
    position: fixed;
    inset: 0;
    z-index: -1;
}

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background-color: var(--background);
    backdrop-filter: blur(40px);
    border-bottom: 1px solid hsl(0, 0%, 25%);
    box-shadow: rgba(0, 0, 0, 0.24) 0px 3px 8px;
}

.header-content {
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-icon {
    position: relative;
    margin-top: 6px;
}

.header-logo {
    width: auto;
    height: 2rem;
    color: var(--primary);
    margin-right: 15px;
}

.logo-text {
    background: var(--foreground);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    width: 300px;
}

.header-social {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: auto;
    white-space: nowrap;
    scrollbar-gutter: stable;
    scrollbar-color: hsl(76, 91%, 50%) transparent;
    scrollbar-width: thin;
}


/* Main Content */
.main-content {
    padding-top: 6rem;
    padding-bottom: 2rem;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease-out;
}

.hero-title {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero-subtitle {
    color: var(--muted-foreground);
    max-width: 600px;
    margin: 0 auto;
}

/* Input Section */
.input-section {
    max-width: 700px;
    margin: 0 auto 3rem;
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.6s ease-out 0.2s both;
}

.input-wrapper {
    position: relative;
    flex: 1;
}

.input-field {
    width: 100%;
    height: 2.5rem;
    padding: 0 3rem 0 1.25rem;
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 1rem;
    transition: all 0.3s;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0px 7px hsl(0, 0%, 100%);
}

.clear-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.clear-btn:hover {
    color: var(--foreground);
}

.fetch-btn {
    height: 2.5rem;
    padding: 0 2rem;
    background: hsl(76, 91%, 50%);
    color: hsl(0, 0%, 0%);
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

.fetch-btn:hover {
    opacity: 0.9;
    transform: scale(1.02);
}

.fetch-btn:active {
    transform: scale(0.98);
}

.fetch-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Thumbnails Grid */
.thumbnails-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
    gap: 3rem;
    margin-bottom: 3rem;
    animation: fadeIn 0.6s ease-out;
}

.thumbnail-card {
    background: hsl(0, 0%, 100%);
    backdrop-filter: blur(40px);
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.thumbnail-card:hover {
    border-color: hsla(217, 91%, 60%, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 0 60px hsla(217, 91%, 60%, 0.4);
}

.thumbnail-image-wrapper {
    position: relative;
    aspect-ratio: 16 / 9;
    background-color: #e7e9eb;
    overflow: hidden;
}

.thumbnail-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e7e9eb;
}

.placeholder-icon {
    position: relative;
}

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.7s;
}

.thumbnail-card:hover .thumbnail-image {
    transform: scale(1.1);
}

.thumbnail-overlay {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s;
}

.thumbnail-card:hover .thumbnail-overlay {
    opacity: 1;
}

.thumbnail-content {
    padding: 1rem;
}

.thumbnail-quality {
    font-size: 0.875rem;
    font-weight: bold;
    color: var(--background);
    margin-bottom: 0.75rem;
    text-align: center;
}

.download-btn {
    width: 100%;
    height: 2.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: linear-gradient(120deg, var(--primary), var(--secondary), var(--accent));
    color: var(--primary-foreground);
    border: none;
    border-radius: calc(var(--radius) - 4px);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.download-btn:hover {
    opacity: 1;
}

.download-btn:active {
    transform: scale(0.95);
}

.download-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: scale(1);
}

.download-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.7s;
}

.download-btn:hover::before {
    transform: translateX(100%);
}

/* Empty State */
.empty-state {
    text-align: center;
    color: var(--muted-foreground);
}

.empty-icon {
    margin-bottom: 1rem;
    color: #cccccc;
}

.empty-icon svg {
    width: 3rem;
    height: 3rem;
}

/* Sections */
.section-header {
    text-align: left;
    line-height: 3rem;
    max-width: 700px;
    margin: 3rem auto;
    padding: 0 1rem;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 3rem;
}

.section-subtitle {
    color: var(--muted-foreground);
    text-align: center;
}

/* About Section */
.about-section {
    margin-bottom: 3rem;
    margin-top: 3rem;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100%, 1fr));
    gap: 1.5rem;
}

@media (min-width: 1024px) {
    .about-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.about-card {
    backdrop-filter: blur(40px);
    border: 1px solid hsla(76, 91%, 50%, 0.2);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s;
}

.about-card:hover {
    border-color: hsl(76, 91%, 50%);
    transform: translateY(-4px);
    box-shadow: 0 0px 7px hsl(0, 0%, 100%);
}

.about-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius);
    background-color: hsla(76, 91%, 50%, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    color: hsl(0, 0%, 0%);
    transition: background-color 0.3s;
}

.about-card:hover .about-icon {
    background-color: hsl(76, 91%, 50%);
}

.about-card-title {
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.about-card-text {
    color: var(--muted-foreground);
}

/* FAQ Section */
.faq-section {
    margin-bottom: 2rem;
}

.accordion {
    max-width: 1200px;
    margin: 0 auto;
}

.accordion-item {
    backdrop-filter: blur(40px);
    border: 1px solid hsla(76, 91%, 50%, 0.2);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    overflow: hidden;
    transition: all 0.3s;
}

.accordion-item:hover {
    border-color: hsl(76, 91%, 50%);
    box-shadow: 0 0px 7px hsl(0, 0%, 100%);
}

.accordion-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    background: none;
    border: none;
    color: var(--foreground);
    font-size: 1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: color 0.3s;
}

.accordion-trigger:hover {
    font-weight: bold;
}

.accordion-icon {
    flex-shrink: 0;
    transition: transform 0.3s;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
}

.accordion-item.active .accordion-content {
    max-height: 500px;
    padding: 0 1.5rem 1.25rem;
}

.accordion-content p {
    color: var(--muted-foreground);
    line-height: 1.6;
}

/* Footer */
.footer {
    background-color: var(--background);
    backdrop-filter: blur(40px);
    border-top: 1px solid hsl(0, 0%, 25%);
    box-shadow: rgba(0, 0, 0, 0.24) 0px -3px 8px;
    color: var(--muted-foreground);
}

.footer-grid {
    padding: 1.5rem 0;
    text-align: center;
}

.footer-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.75rem;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.footer-links {
    list-style: none;
    padding: 10px 0px;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-link {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-link:hover {
    text-decoration: underline;
}

.footer-bottom {
    padding: 1.5rem 0;
    border-top: 1px solid hsl(0, 0%, 25%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.footer-copyright {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.heart-icon {
    color: var(--secondary);
}

/* Progress Modal */
.progress-modal {
    position: fixed;
    top: 5rem;
    right: 1rem;
    z-index: 100;
    animation: slideUp 0.3s ease-out;
}

.progress-card {
    width: 320px;
    padding: 1rem;
    background: var(--background);
    backdrop-filter: blur(40px);
    border: 1px solid hsla(217, 91%, 60%, 0.2);
    border-radius: var(--radius);
    box-shadow: 0 0 60px hsla(217, 91%, 60%, 0.4);
}

.progress-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.progress-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.progress-icon {
    color: var(--primary);
}

.progress-icon.complete {
    animation: scaleIn 0.3s ease-out;
}

.progress-icon.downloading {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.progress-close {
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    padding: 0;
    transition: color 0.3s;
}

.progress-close:hover {
    color: var(--foreground);
}

.progress-filename {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress-wrapper {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.progress-bar {
    width: 100%;
    height: 0.5rem;
    background-color: var(--muted);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(120deg, var(--primary), var(--secondary), var(--accent));
    transition: width 0.3s;
    border-radius: 9999px;
}

.progress-percent {
    font-size: 0.75rem;
    color: var(--muted-foreground);
    text-align: right;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 5rem;
    right: 1rem;
    background: var(--background);
    border: 1px solid hsla(217, 91%, 60%, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    color: var(--foreground);
    z-index: 1000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    max-width: 400px;
    font-size: 0.875rem;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.toast.error {
    border-color: hsla(0, 84%, 60%, 0.5);
    box-shadow: 0 0 60px hsla(0, 84%, 60%, 0.3);
}

.toast.success {
    border-color: hsla(142, 76%, 36%, 0.5);
    box-shadow: 0 0 60px hsla(142, 76%, 36%, 0.3);
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2rem;
    }
    
    .logo-text {
        font-size: 18px;
        width: auto;
    }

    .input-section {
        flex-direction: column;
    }

    .section-title {
        font-size: 1.5rem;
    }

    .footer-bottom {
        text-align: center;
    }

    .progress-modal {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .progress-card {
        width: 100%;
    }
}
