/* Design tokens / Variables */
:root {
    --bg-dark: #0b0f19;
    --card-bg: rgba(22, 30, 49, 0.65);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.18);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --primary-color: #ef4444; /* YouTube Red */
    --primary-glow: rgba(239, 68, 68, 0.4);
    --secondary-color: #4f46e5; /* Indigo */
    --secondary-glow: rgba(79, 70, 229, 0.4);
    --accent-glow: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(239, 68, 68, 0.05) 100%);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-display: 'Outfit', sans-serif;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* Decorative Background Orbs */
.stars-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(white, rgba(255,255,255,.2) 2px, transparent 40px),
        radial-gradient(white, rgba(255,255,255,.15) 1px, transparent 30px),
        radial-gradient(white, rgba(255,255,255,.1) 2px, transparent 40px);
    background-size: 550px 550px, 350px 350px, 250px 250px;
    background-position: 0 0, 40px 60px, 130px 270px;
    opacity: 0.08;
    z-index: -3;
}

.glowing-orb {
    position: fixed;
    width: 45vw;
    height: 45vw;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.15;
    z-index: -2;
    pointer-events: none;
    animation: float 20s infinite alternate ease-in-out;
}

.orb-1 {
    background: radial-gradient(circle, var(--primary-color) 0%, rgba(0,0,0,0) 70%);
    top: -10%;
    right: -5%;
}

.orb-2 {
    background: radial-gradient(circle, var(--secondary-color) 0%, rgba(0,0,0,0) 70%);
    bottom: -10%;
    left: -5%;
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(4%, 6%) scale(1.15); }
}

/* Main Wrapper */
.app-container {
    width: 100%;
    max-width: 900px;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    position: relative;
    z-index: 1;
}

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

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

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 15px var(--primary-glow));
    animation: pulse 2s infinite ease-in-out;
}

.logo-title {
    font-family: var(--font-display);
    font-size: 2.75rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #ffffff 40%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-title span {
    background: linear-gradient(135deg, var(--primary-color) 30%, #f43f5e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    font-weight: 400;
}

.app-subtitle code {
    background: rgba(255, 255, 255, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    color: #f43f5e;
    font-family: monospace;
    font-size: 0.95em;
}

/* Glassmorphism Panel Common */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition);
}

.glass-panel:hover {
    border-color: var(--border-hover);
}

/* Input Section */
.search-section {
    width: 100%;
}

.input-glass-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1.5px solid var(--border-color);
    border-radius: 50px;
    padding: 0.5rem 0.5rem 0.5rem 1.5rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: var(--transition);
}

.input-glass-wrapper:focus-within {
    border-color: var(--secondary-color);
    box-shadow: 0 0 25px rgba(79, 70, 229, 0.25), inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.search-icon {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-right: 0.75rem;
}

.input-glass-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1.05rem;
    padding: 0.6rem 0;
    width: 100%;
}

.input-glass-wrapper input::placeholder {
    color: var(--text-muted);
}

.btn-input-action {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: var(--transition);
}

.btn-input-action:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.08);
}

.btn-paste {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #4338ca 100%);
    color: white;
    border-radius: 25px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    gap: 0.4rem;
    box-shadow: 0 4px 12px var(--secondary-glow);
}

.btn-paste:hover {
    background: linear-gradient(135deg, #6366f1 0%, var(--secondary-color) 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.4);
}

.error-text {
    color: #f87171;
    font-size: 0.9rem;
    margin-top: 0.75rem;
    padding-left: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}

/* Spinner Loader */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease-out;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3.5px solid rgba(255, 255, 255, 0.05);
    border-top: 3.5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Results Area */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
    animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Featured Preview Card */
.featured-card {
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
}

.featured-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-glow);
    pointer-events: none;
}

.card-badge {
    position: absolute;
    top: 1.25rem;
    left: 1.25rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #dc2626 100%);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.8rem;
    border-radius: 30px;
    box-shadow: 0 4px 10px var(--primary-glow);
    z-index: 2;
}

.preview-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 12px;
    overflow: hidden;
    background: #07090e;
    border: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

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

.featured-card:hover .preview-wrapper img {
    transform: scale(1.02);
}

.featured-info {
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    position: relative;
    z-index: 1;
}

.info-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

.meta-value {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.featured-actions {
    display: flex;
    gap: 0.75rem;
}

/* Button Classes */
button {
    font-family: var(--font-sans);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-dark);
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
    background: #e2e8f0;
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
}

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

/* Alternate Resolutions Grid */
.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    background: linear-gradient(135deg, #ffffff 60%, #cbd5e1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Quality Sub-card */
.quality-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.quality-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.quality-resolution {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04);
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
}

.quality-preview {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: 8px;
    overflow: hidden;
    background: #07090e;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.quality-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quality-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.btn-card-action {
    padding: 0.6rem 0.5rem;
    font-size: 0.85rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
}

.btn-card-action:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-card-action.highlight {
    background: rgba(79, 70, 229, 0.15);
    border-color: rgba(79, 70, 229, 0.3);
    color: #a5b4fc;
}

.btn-card-action.highlight:hover {
    background: rgba(79, 70, 229, 0.25);
    border-color: rgba(79, 70, 229, 0.5);
    color: white;
}

/* Footer Section */
.app-footer {
    margin-top: auto;
    padding: 2rem 0 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.disclaimer-box {
    padding: 1.25rem;
    max-width: 100%;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    border-left: 3px solid var(--primary-color);
}

.disclaimer-box strong {
    color: var(--text-primary);
}

.credits {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Keyframes animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 15px var(--primary-glow));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px rgba(239, 68, 68, 0.6));
    }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    body {
        padding: 1.5rem 0.5rem;
    }
    
    .logo-title {
        font-size: 2.25rem;
    }
    
    .logo-icon {
        font-size: 2rem;
    }
    
    .app-subtitle {
        font-size: 0.95rem;
    }
    
    .input-glass-wrapper {
        padding: 0.4rem 0.4rem 0.4rem 1rem;
    }
    
    .btn-paste {
        padding: 0.5rem 0.9rem;
        font-size: 0.85rem;
    }
    
    .featured-card {
        padding: 1rem;
    }
    
    .featured-info {
        flex-direction: column;
        align-items: stretch;
    }
    
    .featured-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    
    .btn-primary, .btn-secondary {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        width: 100%;
    }
}

/* Tabs Styling */
.tabs-container {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    background: rgba(15, 23, 42, 0.4);
    padding: 0.4rem;
    border-radius: 30px;
    border: 1px solid var(--border-color);
    max-width: fit-content;
    margin-left: auto;
    margin-right: auto;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.6rem 1.4rem;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

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

.tab-btn.active {
    color: white;
}

#tab-normal.active {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #4338ca 100%);
    box-shadow: 0 4px 15px var(--secondary-glow);
}

#tab-live.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, #b91c1c 100%);
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-panel.active {
    display: block;
}

@media (max-width: 640px) {
    .tabs-container {
        width: 100%;
        max-width: 100%;
        gap: 0.5rem;
    }
    .tab-btn {
        flex: 1;
        padding: 0.5rem 0.8rem;
        font-size: 0.85rem;
        text-align: center;
    }
}

/* Converted Link Styles */
.info-meta-group {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    align-items: flex-start;
}

.text-link {
    font-size: 0.85rem;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    vertical-align: middle;
    color: #a5b4fc !important;
}

.btn-icon-only {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
    transition: var(--transition);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-only:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}
