:root {
    --bg-deep: #050507;
    --glass-panel: rgba(20, 20, 25, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --accent-primary: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-secondary: #ec4899;
    --success: #10b981;
    --text-main: #ffffff;
    --text-dim: #94a3b8;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-deep);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* --- Dynamic Background --- */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    animation: orbFloat 10s infinite alternate;
}
.orb-1 { width: 400px; height: 400px; background: #4f46e5; top: -100px; left: -100px; opacity: 0.2; }
.orb-2 { width: 300px; height: 300px; background: #db2777; bottom: -50px; right: -50px; opacity: 0.15; animation-delay: -5s; }

@keyframes orbFloat { 0% { transform: translate(0, 0); } 100% { transform: translate(30px, 50px); } }

/* --- Layout Grid (Bento Style) --- */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1.4fr 0.6fr;
    gap: 20px;
    min-height: 100vh;
    align-content: center;
}

/* --- Common Card Style --- */
.card {
    background: var(--glass-panel);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    position: relative;
    overflow: hidden;
}

/* --- Left Side: Main Downloader --- */
.main-section { display: flex; flex-direction: column; gap: 20px; }

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    padding: 6px 12px;
    border-radius: 100px;
    font-size: 0.8rem;
    color: #818cf8;
    font-weight: 600;
    margin-bottom: 15px;
    width: fit-content;
}

.hero-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.8rem;
    line-height: 1.1;
    font-weight: 700;
    background: linear-gradient(to right, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
}

.input-group {
    position: relative;
    margin-top: 20px;
}

.input-box {
    width: 100%;
    background: rgba(0,0,0,0.4);
    border: 1px solid var(--glass-border);
    padding: 20px 20px 20px 55px;
    border-radius: 16px;
    color: white;
    font-size: 1.1rem;
    transition: all 0.3s;
    font-family: 'Space Grotesk', monospace;
}

.input-box:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    outline: none;
}

.input-icon {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    font-size: 1.2rem;
}

.btn-download {
    margin-top: 15px;
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    border: none;
    border-radius: 16px;
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 10px 20px -5px var(--accent-glow);
}

.btn-download:hover { transform: translateY(-3px); box-shadow: 0 15px 30px -5px var(--accent-glow); }
.btn-download:disabled { opacity: 0.6; cursor: wait; }

/* --- Right Side: Widgets Area --- */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

/* Widget: Live Stats */
.stats-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.stat-item {
    background: rgba(255,255,255,0.03);
    border-radius: 16px;
    padding: 15px;
    text-align: center;
}
.stat-val { font-size: 1.5rem; font-weight: 700; color: white; display: block; font-family: 'Space Grotesk'; }
.stat-label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

/* Widget: Server Activity (Fake Terminal) */
.activity-widget {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}
.widget-title { font-size: 0.9rem; font-weight: 600; color: var(--text-dim); }
.live-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 10px var(--success); animation: pulse 2s infinite; }

.log-container {
    height: 200px;
    overflow: hidden;
    position: relative;
    font-family: 'Space Grotesk', monospace;
    font-size: 0.8rem;
}

.log-container::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0; height: 50px;
    background: linear-gradient(to top, var(--glass-panel), transparent);
}

.log-item {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}
.log-time { color: var(--accent-primary); opacity: 0.8; }
.log-text { color: var(--text-dim); }
.log-success { color: var(--success); }

/* --- Result Area (Updated) --- */
.result-panel {
    margin-top: 30px;
    display: none; /* Hidden by default */
    animation: fadeInUp 0.5s ease;
}

.video-card-horiz {
    background: rgba(0,0,0,0.3);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    gap: 20px;
    align-items: center;
}

.thumb-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
}

.thumb-wrapper img { width: 100%; height: 100%; object-fit: cover; }
.play-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: white; font-size: 1.5rem; text-shadow: 0 2px 10px rgba(0,0,0,0.5); }

.info-col { flex: 1; }
.vid-title { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;}
.vid-author { color: var(--accent-primary); font-size: 0.9rem; margin-bottom: 15px; display: block; font-weight: 500; }

.btn-grid { display: flex; gap: 10px; }

.btn-action {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.btn-pri { background: white; color: black; }
.btn-sec { background: rgba(255,255,255,0.1); color: white; }
.btn-pri:hover { background: #e0e0e0; }
.btn-sec:hover { background: rgba(255,255,255,0.2); }

/* --- Animations --- */
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeInUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* --- Mobile --- */
@media (max-width: 900px) {
    .app-container { grid-template-columns: 1fr; padding: 15px; }
    .hero-title { font-size: 2rem; }
    .sidebar { order: 2; }
    .stats-card { grid-template-columns: 1fr 1fr 1fr; }
}
@media (max-width: 600px) {
    .video-card-horiz { flex-direction: column; text-align: center; }
    .thumb-wrapper { width: 100%; height: 200px; }
    .btn-grid { flex-direction: column; }
    .stats-card { grid-template-columns: 1fr; }
}

/* Loading */
.loader-bar { height: 4px; width: 100%; background: rgba(255,255,255,0.1); margin-top: 20px; border-radius: 4px; overflow: hidden; display: none; }
.loader-fill { height: 100%; background: var(--accent-primary); width: 0%; animation: load 1.5s infinite ease-in-out; }
@keyframes load { 0% { width: 0%; left: 0; } 50% { width: 70%; } 100% { width: 100%; } }

.error-msg { color: #f87171; font-size: 0.9rem; margin-top: 10px; display: none; }