/* Custom CSS Design System - TubeSnap Premium Downloader */

:root {
    --bg-dark: #090D16;
    --bg-dark-card: rgba(17, 24, 39, 0.7);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    
    --primary: #8B5CF6;
    --primary-glow: rgba(139, 92, 246, 0.4);
    --secondary: #EC4899;
    --secondary-glow: rgba(236, 72, 153, 0.4);
    --cyan: #06B6D4;
    --cyan-glow: rgba(6, 182, 212, 0.4);
    
    --grad-primary: linear-gradient(135deg, #8B5CF6 0%, #EC4899 100%);
    --grad-cyan: linear-gradient(135deg, #06B6D4 0%, #3B82F6 100%);
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 1. Global Reset & Basic Setup */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: -webkit-fill-available;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background Glow Blobs */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(150px);
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
    animation: floatGlow 15s infinite alternate ease-in-out;
}

.bg-glow-1 {
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    top: -200px;
    right: -100px;
}

.bg-glow-2 {
    background: radial-gradient(circle, var(--cyan) 0%, transparent 70%);
    bottom: 100px;
    left: -200px;
    animation-delay: -5s;
}

@keyframes floatGlow {
    0% {
        transform: translate(0, 0) scale(1);
    }
    100% {
        transform: translate(80px, 50px) scale(1.1);
    }
}

/* Typography elements */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

/* 2. Glassmorphism Panel styles */
.glass-panel {
    background: var(--bg-dark-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 15px 35px -5px rgba(0, 0, 0, 0.4), 
                0 5px 15px -5px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: var(--border-hover);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.5), 
                0 0 20px 0px rgba(139, 92, 246, 0.05);
}

/* 3. Navigation Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(9, 13, 22, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.logo span {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 0.5rem 0.25rem;
    position: relative;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--grad-primary);
    border-radius: 4px;
    transition: var(--transition);
}

.nav-link.active::after, .nav-link:hover::after {
    width: 100%;
}

.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
}

/* 4. Layout & Main Content */
.main-content {
    flex: 1;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 3rem 2rem;
}

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

/* Page Section visibility logic (SPA) */
.view-section {
    display: none;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.view-section.active-section {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

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

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 1rem;
    border-radius: 100px;
    background: rgba(139, 92, 246, 0.15);
    border: 1px solid rgba(139, 92, 246, 0.3);
    color: #A78BFA;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero-title {
    font-size: 3.25rem;
    line-height: 1.15;
    margin-bottom: 1.25rem;
    font-weight: 800;
}

.gradient-text {
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* 5. Input Bar / Search Box */
.search-wrapper {
    max-width: 850px;
    margin: 0 auto 4rem auto;
}

.search-box {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem 0.75rem 1.5rem;
    gap: 1rem;
    border-radius: 100px;
    position: relative;
}

.search-box:focus-within {
    border-color: rgba(139, 92, 246, 0.5);
    box-shadow: 0 0 25px 0px rgba(139, 92, 246, 0.15);
}

.input-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.search-box input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1.05rem;
    font-family: inherit;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.clear-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    border-radius: 50%;
}

.clear-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: 100px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.btn-icon {
    padding: 0.75rem 1.25rem;
}

.btn-primary {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
    filter: brightness(1.1);
}

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

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--border-hover);
}

.btn-block {
    width: 100%;
}

.error-text {
    color: #F87171;
    font-size: 0.85rem;
    margin-top: 0.75rem;
    margin-left: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 6. Loader Spinner */
.loader-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin: 4rem 0;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 3px stroke var(--border-color);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loader-wrapper p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 7. Grid Features Overview */
.features-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.feature-card {
    padding: 2.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glow-cyan {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.2);
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.glow-violet {
    background: rgba(139, 92, 246, 0.12);
    color: var(--primary);
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.15);
}

.glow-pink {
    background: rgba(236, 72, 153, 0.12);
    color: var(--secondary);
    border: 1px solid rgba(236, 72, 153, 0.2);
    box-shadow: 0 0 15px rgba(236, 72, 153, 0.15);
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-top: 0.5rem;
}

.feature-card p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* 8. Results Panel & Cards */
.results-container {
    animation: fadeIn 0.5s ease-out;
}

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

.results-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.results-header h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.video-title {
    color: var(--text-secondary);
    font-weight: 500;
    max-width: 700px;
    margin: 0 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 2rem;
    margin-bottom: 4rem;
}

/* The Premium Card design */
.thumbnail-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preview-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #020617;
    overflow: hidden;
}

.preview-wrapper img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.thumbnail-card:hover .preview-wrapper img {
    transform: scale(1.05);
}

.resolution-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
}

.card-info {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1.5rem;
}

.spec-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.spec-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.spec-label {
    color: var(--text-muted);
}

.spec-value {
    color: var(--text-primary);
    font-weight: 500;
}

.spec-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* 9. Premium Pages Styling */
.content-page {
    padding: 3rem;
    margin-top: 1.5rem;
}

.content-page h2 {
    font-size: 2.25rem;
    margin-bottom: 0.5rem;
}

.section-divider {
    height: 3px;
    width: 60px;
    background: var(--grad-primary);
    border-radius: 10px;
    margin-bottom: 2rem;
}

.content-page h3 {
    font-size: 1.4rem;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

.content-page p {
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
}

.content-page ul {
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
    color: var(--text-secondary);
}

.content-page li {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 2rem !important;
}

.text-muted {
    color: var(--text-muted);
}

/* Contact Form styles */
.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input, 
.form-group textarea {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.form-group input:focus, 
.form-group textarea:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.6);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.1);
}

/* 10. Footer Section */
.footer {
    background: #04070D;
    border-top: 1px solid var(--border-color);
    padding: 4rem 2rem 2rem 2rem;
    margin-top: 6rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 3rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-brand {
    max-width: 320px;
}

.footer-brand .logo {
    margin-bottom: 1rem;
}

.footer-brand p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

.footer-column h4 {
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.footer-column a {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-column a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    max-width: 1200px;
    margin: 2rem auto 0 auto;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* 11. Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    pointer-events: none;
}

.toast {
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 300px;
    max-width: 450px;
    pointer-events: auto;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
               fadeAndSlideOut 0.3s cubic-bezier(0.16, 1, 0.3, 1) 3.7s forwards;
}

.toast-success {
    border-left: 4px solid #10B981;
}

.toast-error {
    border-left: 4px solid #EF4444;
}

.toast-info {
    border-left: 4px solid var(--primary);
}

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

@keyframes fadeAndSlideOut {
    from {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
    to {
        transform: translateY(-10px) scale(0.95);
        opacity: 0;
    }
}

/* 12. Media Queries */
@media (max-width: 900px) {
    .header-container {
        padding: 1rem 1.5rem;
    }
    
    .main-content {
        padding: 2rem 1.5rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .features-row {
        grid-template-columns: 1fr;
    }
    
    .footer-links {
        gap: 3rem;
    }
    
    .content-page {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    .mobile-toggle {
        display: block;
    }
    
    .nav-menu {
        position: fixed;
        top: 69px; /* Height of header */
        left: 0;
        right: 0;
        background: rgba(9, 13, 22, 0.98);
        border-bottom: 1px solid var(--border-color);
        padding: 2rem 1.5rem;
        flex-direction: column;
        gap: 1.5rem;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: var(--transition);
        z-index: 99;
    }
    
    .nav-menu.mobile-active {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }
    
    .nav-link::after {
        display: none;
    }
    
    .search-box {
        border-radius: 20px;
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem;
    }
    
    .search-box input {
        padding: 0.5rem 0;
    }
    
    .search-actions {
        margin-top: 0.5rem;
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        width: 100%;
        padding: 0.85rem;
    }
    
    .clear-btn {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    
    .form-group-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .footer-container {
        flex-direction: column;
        gap: 2rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 2rem;
    }
    
    .thumbnail-grid {
        grid-template-columns: 1fr;
    }
    
    /* Hamburger Animation helper */
    .mobile-toggle.active #line1 {
        transform: translateY(6px) rotate(45deg);
        transform-origin: center;
    }
    .mobile-toggle.active #line2 {
        opacity: 0;
    }
    .mobile-toggle.active #line3 {
        transform: translateY(-6px) rotate(-45deg);
        transform-origin: center;
    }
    .mobile-toggle svg line {
        transition: var(--transition);
    }
}
