/* ══════════════════════════════════════════════════════════════
   Newral Downloader · Dark Theme Stylesheet
   ══════════════════════════════════════════════════════════════ */

:root {
    --bg-body:       #08090d;
    --bg-card:       #11141d;
    --bg-card-2:     #161a26;
    --bg-input:      #1c202e;
    --accent:        #4F8EF7;
    --accent-dim:    #3366cc;
    --accent-glow:   rgba(79, 142, 247, 0.25);
    --text-main:     #e8eaf0;
    --text-sub:      #8b90a7;
    --text-dim:      #555a6e;
    --success:       #22c55e;
    --error:         #ef4444;
    --warning:       #f59e0b;
    --radius:        16px;
    --radius-sm:     10px;
    --transition:    0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    font-size: 15px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* ─── Thick Custom Scrollbar ─── */
::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

::-webkit-scrollbar-track {
    background: #08090d;
}

::-webkit-scrollbar-thumb {
    background: #232838;
    border-radius: 10px;
    border: 3px solid #08090d;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #4F8EF7, #7c3aed);
    border: 2px solid #08090d;
}

* {
    scrollbar-width: thin;
    scrollbar-color: #232838 #08090d;
}

/* ─── Animated Background ─── */
.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(79, 142, 247, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(79, 142, 247, 0.035) 1px, transparent 1px);
    background-size: 48px 48px;
    pointer-events: none;
}

.glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(110px);
    opacity: 0.14;
    pointer-events: none;
    z-index: 0;
}

.glow-1 {
    width: 520px;
    height: 520px;
    background: var(--accent);
    top: -150px;
    right: -100px;
    animation: float 14s ease-in-out infinite;
}

.glow-2 {
    width: 440px;
    height: 440px;
    background: #8b5cf6;
    bottom: -100px;
    left: -80px;
    animation: float 18s ease-in-out infinite reverse;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(25px, 20px); }
}

/* ─── Header ─── */
header {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 36px 20px 24px;
    max-width: 680px;
    margin: 0 auto;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    font-size: 26px;
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--accent-glow);
    color: #fff;
}

.logo h1 {
    font-size: 1.65rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.tagline {
    font-size: 0.8rem;
    color: var(--text-sub);
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* ─── Main Container ─── */
main {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 10px 20px 80px;
}

/* ─── Base Card ─── */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    transition: border-color var(--transition);
}

.card-url {
    position: relative;
}

.close-panel-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-sub);
    font-size: 1.1rem;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 1;
}

.close-panel-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

.card-label {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-sub);
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ─── Input & Buttons ─── */
.url-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.url-row input {
    flex: 1;
    height: 48px;
    padding: 0 16px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-input);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.url-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.url-row input::placeholder {
    color: var(--text-dim);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-outline {
    background: rgba(79, 142, 247, 0.08);
    color: var(--accent);
    border: 1.5px solid rgba(79, 142, 247, 0.3);
    height: 48px;
    padding: 0 20px;
}

.btn-outline:hover {
    background: rgba(79, 142, 247, 0.18);
    border-color: var(--accent);
    color: #fff;
}

.btn-download {
    width: 100%;
    height: 50px;
    background: linear-gradient(135deg, var(--accent), #7c3aed);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border-radius: 12px;
    box-shadow: 0 6px 24px var(--accent-glow);
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(79, 142, 247, 0.45);
}

.btn-download:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ─── Download Card (Active / Finished / Error) ─── */
.download-card {
    position: relative;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    animation: fadeUp 0.35s ease-out both;
}

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

/* Standalone Close '✕' Button on Top-Right Corner */
.delete-card-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-dim);
    font-size: 1.15rem;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 10;
    line-height: 1;
}

.delete-card-btn:hover {
    color: #fff;
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

.download-card-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding-right: 44px; /* Space for the top-right ✕ button */
    margin-bottom: 16px;
}

.dl-thumb {
    width: 108px;
    height: 68px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--bg-input);
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.dl-info {
    flex: 1;
    min-width: 0;
}

.dl-title {
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
    color: var(--text-main);
}

.dl-badges {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.chip {
    font-size: 0.74rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    letter-spacing: 0.3px;
}

.chip-starting, .chip-downloading {
    background: rgba(79, 142, 247, 0.15);
    color: var(--accent);
    border: 1px solid rgba(79, 142, 247, 0.3);
}

.chip-completed {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.chip-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.chip-cancelled {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Quality Resolution Badge (8K, 4K, 1080p, etc.) */
.chip-quality {
    background: rgba(168, 85, 247, 0.18);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
    font-weight: 700;
}

/* ─── Progress Bar ─── */
.progress-section {
    margin-top: 14px;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #8b5cf6);
    border-radius: 10px;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px var(--accent-glow);
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-sub);
    font-weight: 500;
}

/* ─── Card Actions & Buttons ─── */
.dl-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    align-items: center;
    justify-content: flex-end;
}

.btn-save {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 20px;
    font-size: 0.86rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    border: none;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--accent-glow);
    transition: all 0.2s;
}

.btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(79, 142, 247, 0.4);
}

.btn-cancel-task {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 36px;
    padding: 0 16px;
    font-size: 0.84rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--text-sub);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel-task:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

/* Error message row */
.dl-error-row {
    display: flex;
    align-items: center;
    width: 100%;
    margin-top: 14px;
}

.dl-error-text {
    color: #ef4444;
    font-size: 0.85rem;
    line-height: 1.5;
    word-break: break-word;
    flex: 1;
}

/* ─── Add Video Button & Container ─── */
.plus-container,
.btn-plus-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 28px 0 20px;
    animation: fadeUp 0.3s ease-out both;
}

.btn-add-video,
.btn-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 48px;
    padding: 0 32px;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    color: #ffffff;
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    border: none !important;
    outline: none !important;
    border-radius: 9999px;
    cursor: pointer;
    box-shadow: 0 6px 24px rgba(79, 142, 247, 0.35), 0 0 16px rgba(124, 58, 237, 0.25);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 0.3px;
}

.btn-add-video svg,
.btn-plus svg {
    stroke-width: 2.8;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.4));
    transition: transform 0.25s ease;
}

.btn-add-video:hover,
.btn-plus:hover {
    transform: translateY(-2px) scale(1.03);
    background: linear-gradient(135deg, #5b96f8 0%, #8b5cf6 100%);
    box-shadow: 0 8px 32px rgba(79, 142, 247, 0.55), 0 0 20px rgba(139, 92, 246, 0.4);
    border: none !important;
    outline: none !important;
}

.btn-add-video:focus,
.btn-plus:focus,
.btn-add-video:focus-visible,
.btn-plus:focus-visible {
    outline: none !important;
    border: none !important;
    box-shadow: 0 6px 24px rgba(79, 142, 247, 0.35), 0 0 16px rgba(124, 58, 237, 0.25) !important;
}

.btn-add-video:active,
.btn-plus:active {
    transform: translateY(0) scale(0.98);
    border: none !important;
    outline: none !important;
}

/* ─── Responsive ─── */
@media (max-width: 600px) {
    header { padding: 24px 16px 16px; }
    main { padding: 0 14px 60px; }
    .card { padding: 18px; }
    .download-card { padding: 18px; }
    .url-row { flex-direction: column; }
    .url-row .btn { width: 100%; }
    .dl-thumb { width: 80px; height: 50px; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}
