/* ==========================================================================
   MediaFetch Downloader - Premium Dark Glassmorphism Styling System
   ========================================================================== */

:root {
    --bg-dark: #0b0f19;
    --bg-card: rgba(19, 26, 43, 0.7);
    --border-glass: rgba(255, 255, 255, 0.1);
    --border-glow: rgba(99, 102, 241, 0.4);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.35);
    
    --accent-yt: #ff0000;
    --accent-yt-short: #ff2a55;
    --accent-ig: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    --accent-fb: #1877f2;
    --accent-tiktok: #00f2fe;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

/* Dynamic Background Glows */
.background-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: floatOrb 18s infinite alternate ease-in-out;
}

.orb-1 {
    top: -10%;
    left: 15%;
    width: 450px;
    height: 450px;
    background: radial-gradient(circle, #6366f1 0%, rgba(99, 102, 241, 0) 70%);
}

.orb-2 {
    bottom: -15%;
    right: 10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #ec4899 0%, rgba(236, 72, 153, 0) 70%);
}

.orb-3 {
    top: 40%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #3b82f6 0%, rgba(59, 130, 246, 0) 70%);
}

@keyframes floatOrb {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(40px, -30px) scale(1.1); }
    100% { transform: translate(-30px, 40px) scale(0.95); }
}

/* App Container */
.app-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 820px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header */
.app-header {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.5);
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.logo-text .highlight {
    background: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tagline {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 6px;
}

.subtitle {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 620px;
    line-height: 1.5;
}

.subtitle strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Glass Panel Card */
.glass-panel {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    padding: 2.2rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: var(--transition-smooth);
}

/* Input Section */
.input-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.5rem 0.4rem 1.2rem;
    transition: var(--transition-fast);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 25px var(--primary-glow);
}

.input-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-right: 0.75rem;
    transition: var(--transition-fast);
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

#url-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1.05rem;
    padding: 0.6rem 0;
}

#url-input::placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-input-action {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-fast);
}

.btn-input-action:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Detection Bar & Badges */
.detection-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-top: 0.25rem;
    animation: fadeIn 0.3s ease-out;
}

.detection-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.badge-youtube {
    background: rgba(255, 0, 0, 0.15);
    color: #ff4d4d;
    border: 1px solid rgba(255, 0, 0, 0.4);
}

.badge-yt-short {
    background: rgba(255, 42, 85, 0.15);
    color: #ff5e7e;
    border: 1px solid rgba(255, 42, 85, 0.4);
}

.badge-instagram {
    background: rgba(220, 39, 67, 0.15);
    color: #f472b6;
    border: 1px solid rgba(220, 39, 67, 0.4);
}

.badge-facebook {
    background: rgba(24, 119, 242, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(24, 119, 242, 0.4);
}

.badge-tiktok {
    background: rgba(0, 242, 254, 0.15);
    color: #00f2fe;
    border: 1px solid rgba(0, 242, 254, 0.4);
}

.badge-generic {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

/* Loader State */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem 0;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

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

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

/* Error State */
.error-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-top: 1rem;
    font-size: 0.95rem;
    animation: shake 0.4s ease-in-out;
}

/* Video Preview Card */
.preview-card {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    animation: slideUp 0.4s ease-out;
}

.preview-content {
    display: flex;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .preview-content {
        flex-direction: column;
    }
}

.thumbnail-wrapper {
    position: relative;
    width: 220px;
    height: 135px;
    border-radius: var(--radius-md);
    overflow: hidden;
    flex-shrink: 0;
    background: #000;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
}

@media (max-width: 640px) {
    .thumbnail-wrapper {
        width: 100%;
        height: 200px;
    }
}

.thumbnail-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.85);
    opacity: 0.8;
    transition: var(--transition-fast);
}

.thumbnail-wrapper:hover .thumbnail-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.2);
}

.duration-tag {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.video-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.video-meta-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.platform-tag {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.uploader-tag {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

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

.download-actions {
    margin-top: auto;
    padding-top: 0.5rem;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: #ffffff;
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.9rem 1.5rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    transition: var(--transition-fast);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(99, 102, 241, 0.55);
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

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

/* Download Progress */
.download-progress-bar {
    position: relative;
    height: 42px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    opacity: 0.85;
    animation: progressIndeterminate 1.8s infinite linear;
    transform-origin: 0% 50%;
}

@keyframes progressIndeterminate {
    0% { transform: translateX(-100%) scaleX(0.2); }
    50% { transform: translateX(0%) scaleX(0.5); }
    100% { transform: translateX(100%) scaleX(0.2); }
}

.progress-text {
    position: relative;
    z-index: 1;
    font-weight: 600;
    font-size: 0.95rem;
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Platforms Section */
.platforms-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-secondary);
}

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

.platform-card {
    background: rgba(19, 26, 43, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius-md);
    padding: 1.25rem 0.75rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.platform-card:hover {
    background: rgba(19, 26, 43, 0.85);
    border-color: rgba(255, 255, 255, 0.18);
    transform: translateY(-3px);
}

.platform-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
    margin-bottom: 0.25rem;
}

.platform-icon.yt { background: #ff0000; box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3); }
.platform-icon.yt-shorts { background: #ff2a55; box-shadow: 0 4px 15px rgba(255, 42, 85, 0.3); }
.platform-icon.ig { background: var(--accent-ig); box-shadow: 0 4px 15px rgba(220, 39, 67, 0.3); }
.platform-icon.fb { background: #1877f2; box-shadow: 0 4px 15px rgba(24, 119, 242, 0.3); }
.platform-icon.tiktok { background: #000000; border: 1px solid rgba(255, 255, 255, 0.2); box-shadow: 0 4px 15px rgba(0, 242, 254, 0.35); color: #fe2c55; }

.platform-card h4 {
    font-size: 0.92rem;
    font-weight: 700;
}

.platform-card p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* History Section */
.history-section {
    background: rgba(19, 26, 43, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.history-header h3 {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-text {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-text:hover {
    color: #ef4444;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
}

.history-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

/* Footer */
.app-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding-top: 1rem;
}

/* Keyframes & Utilities */
.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

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

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}
