/* Design Tokens & Theme Variables */
:root {
    --bg-main: #0a0a16;
    --bg-card: rgba(22, 22, 38, 0.4);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(147, 51, 234, 0.3);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-primary: #a855f7;
    --accent-secondary: #6366f1;
    --accent-gradient: linear-gradient(135deg, #a855f7 0%, #6366f1 100%);
    --btn-hover-gradient: linear-gradient(135deg, #c084fc 0%, #818cf8 100%);
    
    /* Platform Colors */
    --youtube: #ff0000;
    --facebook: #1877f2;
    --instagram: #e1306c;
    --tiktok: #00f2fe;
    --x: #ffffff;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Base resets & layout */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 2rem 1rem;
    overflow-x: hidden;
    position: relative;
}

/* Ambient glow backgrounds */
.ambient-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

.bg-glow-1 {
    background: radial-gradient(circle, #a855f7 0%, rgba(168, 85, 247, 0) 70%);
    top: -100px;
    left: -100px;
}

.bg-glow-2 {
    background: radial-gradient(circle, #6366f1 0%, rgba(99, 102, 241, 0) 70%);
    bottom: -100px;
    right: -100px;
}

/* Container */
.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.app-header {
    text-align: center;
    margin-top: 1rem;
}

.logo-container {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    color: var(--accent-primary);
    filter: drop-shadow(0 0 8px rgba(168, 85, 247, 0.4));
}

.logo-text {
    font-size: 2.25rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    color: var(--text-primary);
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.5;
    font-weight: 400;
}

/* Navigation Tabs */
.tabs-nav {
    display: flex;
    justify-content: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-radius: 8px;
    transition: var(--transition-smooth);
}

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

.tab-btn.active {
    color: var(--accent-primary);
    background: rgba(168, 85, 247, 0.08);
}

.tab-icon {
    width: 1.15rem;
    height: 1.15rem;
}

/* Tab Content toggles */
.tab-content {
    display: none;
    flex-direction: column;
    gap: 2rem;
    width: 100%;
}

.tab-content.active {
    display: flex;
    animation: fadeIn 0.4s ease-out forwards;
}

/* Premium Glassmorphic Cards */
.glass-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 2.25rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3),
                inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: var(--transition-smooth);
}

.glass-card:hover {
    border-color: rgba(168, 85, 247, 0.2);
    box-shadow: 0 20px 50px rgba(168, 85, 247, 0.05),
                0 0 30px rgba(0, 0, 0, 0.3);
}

/* Input Row */
.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(10, 10, 20, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.5rem 0.5rem 0.5rem 1.25rem;
    gap: 0.75rem;
    transition: var(--transition-smooth);
}

.input-wrapper:focus-within {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.25);
}

.platform-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    color: var(--text-secondary);
    transition: var(--transition-smooth);
}

.platform-indicator svg {
    width: 100%;
    height: 100%;
}

.platform-indicator svg.hidden {
    display: none;
}

/* Specific Platform Icons */
.icon-youtube { color: var(--youtube); }
.icon-facebook { color: var(--facebook); }
.icon-instagram { color: var(--instagram); stroke: var(--instagram); }
.icon-tiktok { color: #fff; filter: drop-shadow(2px 0px 0px #fd3c63) drop-shadow(-2px 0px 0px #00f2fe); }
.icon-x { color: var(--x); }

#video-url {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 400;
}

#video-url::placeholder {
    color: var(--text-muted);
}

/* Buttons */
button {
    font-family: inherit;
    cursor: pointer;
}

#paste-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1rem;
    border-radius: 12px;
    font-weight: 500;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

#paste-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.primary-btn {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    transition: var(--transition-smooth);
}

.primary-btn:hover {
    background: var(--btn-hover-gradient);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(168, 85, 247, 0.45);
}

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

.btn-icon-right {
    width: 1.1rem;
    height: 1.1rem;
    transition: var(--transition-smooth);
}

.primary-btn:hover .btn-icon-right {
    transform: translateX(3px);
}

/* Error Box */
.error-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    padding: 1rem 1.25rem;
    border-radius: 16px;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    animation: slideIn 0.3s ease-out forwards;
}

.error-box.hidden {
    display: none;
}

.error-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

/* Loading state styles */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
    padding: 1rem 0;
}

.loading-state.hidden {
    display: none;
}

.spinner-glow {
    width: 3rem;
    height: 3rem;
    border: 3px solid rgba(168, 85, 247, 0.15);
    border-radius: 50%;
    border-top-color: var(--accent-primary);
    border-right-color: var(--accent-secondary);
    animation: spin 1.2s linear infinite;
    position: relative;
}

.spinner-glow::after {
    content: '';
    position: absolute;
    top: -5px; left: -5px; right: -5px; bottom: -5px;
    border-radius: 50%;
    background: transparent;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.4);
    pointer-events: none;
}

.loading-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: flex-start;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    display: inline-block;
    transition: var(--transition-smooth);
}

.loading-step.active {
    color: var(--text-primary);
}

.loading-step.active .step-dot {
    background: var(--accent-primary);
    box-shadow: 0 0 8px var(--accent-primary);
    transform: scale(1.3);
}

.loading-step.completed {
    color: #34d399;
}

.loading-step.completed .step-dot {
    background: #34d399;
}

/* Preview Video Card */
.preview-card {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: slideIn 0.4s ease-out forwards;
}

.preview-card.hidden {
    display: none;
}

.preview-layout {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 1.5rem;
}

.thumbnail-wrapper {
    position: relative;
    border-radius: 14px;
    overflow: hidden;
    aspect-ratio: 16/9;
    border: 1px solid var(--border-color);
    background: #000;
    display: flex;
    align-items: center;
}

#video-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    backdrop-filter: blur(4px);
}

.video-info {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.platform-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    padding: 0.35rem 0.75rem;
    border-radius: 30px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.youtube-badge { background: rgba(255, 0, 0, 0.15); color: #f87171; border: 1px solid rgba(255, 0, 0, 0.2); }
.facebook-badge { background: rgba(24, 119, 242, 0.15); color: #60a5fa; border: 1px solid rgba(24, 119, 242, 0.2); }
.instagram-badge { background: rgba(225, 48, 108, 0.15); color: #f472b6; border: 1px solid rgba(225, 48, 108, 0.2); }
.tiktok-badge { background: rgba(255, 255, 255, 0.08); color: #e5e7eb; border: 1px solid rgba(255, 255, 255, 0.15); }
.x-badge { background: rgba(255, 255, 255, 0.1); color: #fff; border: 1px solid rgba(255, 255, 255, 0.2); }
.link-badge { background: rgba(168, 85, 247, 0.1); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.2); }

.video-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-source-url {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 1rem;
}

.download-button {
    background: var(--accent-gradient);
    border: none;
    color: #fff;
    width: 100%;
    padding: 0.9rem 1.5rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 14px rgba(168, 85, 247, 0.35);
    transition: var(--transition-smooth);
}

.download-button:hover:not(:disabled) {
    background: var(--btn-hover-gradient);
    box-shadow: 0 6px 20px rgba(168, 85, 247, 0.5);
    transform: translateY(-1px);
}

.download-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: none;
}

.download-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Progress bar for stream downloads */
.stream-progress {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.progress-bar-wrapper {
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--accent-gradient);
    width: 0%;
    border-radius: 10px;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.6);
    transition: width 0.3s ease-out;
}

.progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.feature-item {
    background: rgba(22, 22, 38, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: var(--transition-smooth);
}

.feature-item:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background: rgba(22, 22, 38, 0.4);
    transform: translateY(-2px);
}

.feature-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Feature Colors */
.youtube-color { background: rgba(255,0,0,0.1); color: #f87171; }
.meta-color { background: rgba(24,119,242,0.1); color: #60a5fa; }
.insta-color { background: rgba(225,48,108,0.1); color: #f472b6; }
.tiktok-color { background: rgba(255,255,255,0.05); color: #e5e7eb; }
.x-color { background: rgba(255,255,255,0.05); color: #ffffff; }
.shortcut-color { background: rgba(168,85,247,0.1); color: #c084fc; }

.feature-item h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.feature-item p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* Instructions Setup (Shortcut Guide) */
.instruction-card h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.instruction-card > p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.steps-container {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.setup-step {
    display: flex;
    gap: 1.25rem;
}

.step-num {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.15);
}

.step-desc {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.step-desc h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.step-desc p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Code box styling */
.code-box-wrapper {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    margin-top: 0.5rem;
    gap: 1rem;
    justify-content: space-between;
}

#shortcut-url-template {
    font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, Courier, monospace;
    font-size: 0.85rem;
    color: #a78bfa;
    overflow-x: auto;
    white-space: nowrap;
    flex: 1;
}

.copy-code-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-smooth);
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.15);
}

.copy-icon {
    width: 0.9rem;
    height: 0.9rem;
}

.step-desc .note {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.shortcut-tip {
    margin-top: 2rem;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #a5b4fc;
}

.tip-icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent-secondary);
    flex-shrink: 0;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(17, 17, 17, 0.85);
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.9rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Footer styling */
.app-footer-bottom {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

/* Keyframe Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

/* Media Queries for Responsiveness */
@media (max-width: 768px) {
    .preview-layout {
        grid-template-columns: 1fr;
    }
    
    .thumbnail-wrapper {
        max-width: 320px;
        margin: 0 auto;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .logo-text {
        font-size: 1.85rem;
    }
    
    body {
        padding: 1rem 0.5rem;
    }
}
