﻿html {
    overflow-y: scroll;
}

body {
    margin: 0;
    background: #050505;
    color: white;
    font-family: Arial;
}

/* =========================
   Topbar / Logo
   ========================= */

.topbar {
    position: relative;
    z-index: 10;
    padding: 18px 24px 40px 24px;
    border-bottom: none;
    background: #050505;
    box-shadow: none;
}

    .topbar::before,
    .topbar::after {
        display: none;
    }

    .topbar.home-mode {
        min-height: calc(100dvh - 170px);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding-top: 0;
        padding-bottom: 80px;
    }

    .topbar.results-mode {
        min-height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        padding-top: 10px;
        padding-bottom: 14px;
    }

.youtube-logo-link {
    display: inline-block;
    text-decoration: none;
}

.youtube-logo {
    position: relative;
    width: 760px;
    height: 220px;
    margin: 0 auto 26px auto;
    overflow: hidden;
    border-radius: 34px;
    background: radial-gradient(circle at center 70%, rgba(255,20,147,.34), transparent 34%), radial-gradient(circle at center 45%, rgba(255,20,147,.18), transparent 48%), linear-gradient(to bottom, #090909 0%, #020202 65%, #000000 100%);
    box-shadow: 0 0 80px rgba(255,20,147,.16), 0 0 140px rgba(255,20,147,.06), inset 0 0 50px rgba(255,20,147,.12);
}

    .youtube-logo::before {
        content: "";
        position: absolute;
        inset: 0;
        z-index: 0;
        background: linear-gradient(to bottom, rgba(255,20,147,.18), transparent 38%), repeating-linear-gradient( to bottom, rgba(255,20,147,.08) 0px, rgba(255,20,147,.08) 2px, transparent 2px, transparent 18px );
        opacity: .34;
    }

    .youtube-logo::after {
        content: "";
        position: absolute;
        left: 50%;
        z-index: 1;
        bottom: 0;
        width: 620px;
        height: 90px;
        transform: translateX(-50%);
        background: radial-gradient(ellipse at center, rgba(255,20,147,.45), transparent 65%);
        filter: blur(10px);
        opacity: 1;
    }

.topbar.results-mode .youtube-logo {
    width: 420px;
    height: 115px;
    margin-bottom: 14px;
    border-radius: 24px;
}

.youtube-text {
    position: absolute;
    z-index: 3;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    color: white;
    font-size: 92px;
    font-weight: 900;
    letter-spacing: -4px;
    white-space: nowrap;
    text-shadow: 0 0 12px rgba(255,255,255,.5), 0 0 24px rgba(255,20,147,.35), 0 12px 30px rgba(0,0,0,.85);
}

.topbar.results-mode .youtube-text {
    bottom: 14px;
    font-size: 48px;
}

.youtube-text .brand-small {
    position: relative;
    top: -1.2em;
    margin-left: 2px;
    font-size: 0.28em;
}

.special-text {
    display: none;
}


/* Results fallback:
   If results exist but topbar still has home-mode, keep the same design
   but remove the large home spacing so results start directly below search. */
body:has(#resultsContainer .video-card) .topbar.home-mode {
    min-height: auto;
    justify-content: flex-start;
    padding-top: 10px;
    padding-bottom: 14px;
}

    body:has(#resultsContainer .video-card) .topbar.home-mode .youtube-logo {
        width: 420px;
        height: 115px;
        margin-bottom: 14px;
        border-radius: 24px;
    }

    body:has(#resultsContainer .video-card) .topbar.home-mode .youtube-text {
        bottom: 14px;
        font-size: 48px;
    }

body:has(#resultsContainer .video-card) .results {
    margin-top: 16px;
}

/* =========================
   Search
   ========================= */

.search-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    width: fit-content;
    margin: 0 auto;
}

.search-container {
    position: relative;
    width: 100%;
}

.search-input {
    width: 640px;
    height: 54px;
    flex: none;
    padding-right: 24px;
    padding-left: 74px;
    border: 1px solid rgba(255,255,255,.16);
    border-radius: 30px;
    outline: none;
    background: rgba(10,10,10,.92);
    color: white;
    direction: rtl;
    text-align: right;
    font-size: 18px;
    box-shadow: inset 0 0 0 1px rgba(255,20,147,.06), 0 0 28px rgba(255,20,147,.08);
}

    .search-input::placeholder {
        color: rgba(255,255,255,.30);
        text-align: right;
        transition: opacity .2s ease;
    }

    .search-input:focus::placeholder {
        opacity: 0;
    }

.search-button {
    height: 54px;
    min-width: 120px;
    padding: 0 34px;
    border: 1px solid rgba(255,20,147,.35);
    border-radius: 30px;
    background: linear-gradient( 180deg, rgba(255,20,147,.28) 0%, rgba(255,20,147,.16) 100% );
    color: white;
    cursor: pointer;
    font-size: 17px;
    font-weight: 700;
}

.paste-badge {
    position: absolute;
    left: 10px;
    top: 50%;
    z-index: 5;
    transform: translateY(-50%);
    padding: 4px 10px;
    border: none;
    border-radius: 8px;
    background: #E5E7EB;
    color: #111827;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

    .paste-badge:active {
        transform: translateY(-50%) scale(0.96);
    }

.visitor-counter {
    text-align: center;
    margin-top: 10px;
    margin-bottom: 8px;
    color: #94A3B8;
    font-size: 14px;
    font-weight: 600;
}
/* =========================
   Watch History Overlay
   ========================= */

.watch-history-floating-button {
    position: fixed;
    top: 18px;
    right: 18px;
    z-index: 999;
    height: 44px;
    padding: 0 18px;
    border: 1px solid rgba(255,20,147,.30);
    border-radius: 22px;
    background: rgba(15,15,15,.92);
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    backdrop-filter: blur(14px);
    box-shadow: 0 0 30px rgba(255,20,147,.12);
}

    .watch-history-floating-button:hover {
        border-color: rgba(255,20,147,.48);
        background: rgba(255,20,147,.18);
    }

.watch-history-overlay {
    box-sizing: border-box;
    min-height: 100dvh;
    padding: 24px;
    background: #050505;
}

.watch-history-overlay-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto 24px auto;
}

.watch-history-title {
    margin: 0;
    color: white;
    font-size: 24px;
    font-weight: 800;
}

.watch-history-overlay-actions {
    display: flex;
    gap: 12px;
}

.watch-history-close,
.watch-history-clear {
    height: 42px;
    padding: 0 18px;
    border: 1px solid rgba(255,20,147,.28);
    border-radius: 16px;
    background: rgba(255,20,147,.10);
    color: white;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
}

    .watch-history-close:hover,
    .watch-history-clear:hover {
        border-color: rgba(255,20,147,.45);
        background: rgba(255,20,147,.18);
    }

.watch-history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
    max-width: 1200px;
    margin: 0 auto;
}

.watch-history-card {
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 16px;
    background: rgba(255,255,255,.03);
    color: inherit;
    cursor: pointer;
    font-family: inherit;
    text-align: right;
    text-decoration: none;
    appearance: none;
    -webkit-appearance: none;
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

    .watch-history-card:hover {
        transform: translateY(-2px);
        border-color: rgba(255,20,147,.30);
        background: rgba(255,20,147,.06);
    }

.watch-history-thumbnail {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
    background: #000;
}

.watch-history-info {
    padding: 12px;
}

.watch-history-item-title {
    color: white;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.5;
    max-height: 44px;
    overflow: hidden;
}

.watch-history-item-time {
    margin-top: 8px;
    color: #9CA3AF;
    font-size: 12px;
}

/* =========================
   Results
   ========================= */

.results {
    max-width: 1200px;
    margin: 16px auto;
    padding: 0 20px 120px 20px;
}

.video-card {
    display: grid;
    grid-template-columns: 360px 1fr;
    align-items: start;
    gap: 18px;
    margin-bottom: 42px;
}

.thumbnail-container {
    position: relative;
    width: 360px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    cursor: pointer;
}

    .thumbnail-container iframe {
        width: 100%;
        height: 100%;
        border: none;
    }

.thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    right: 8px;
    bottom: 8px;
    z-index: 6;
    min-width: 42px;
    padding: 3px 7px;
    border-radius: 8px;
    background: rgba(0,0,0,.82);
    color: #ffffff;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    backdrop-filter: blur(6px);
    box-shadow: 0 2px 10px rgba(0,0,0,.35);
}

.video-progress-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    height: 4px;
    overflow: hidden;
    background: rgba(255,255,255,.12);
    border-radius: 999px;
}

.video-progress-fill {
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #ff005c 0%, #ff1493 100%);
    box-shadow: 0 0 12px rgba(255,20,147,.45);
    transition: width .18s linear;
}

.video-title {
    padding: 0;
    border: none;
    background: transparent;
    color: white;
    cursor: pointer;
    font-family: inherit;
    font-size: 20px;
    font-weight: bold;
    text-align: right;
    text-decoration: none;
}

.open-full-video-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    margin-top: 8px;
    padding: 6px 12px;
    border: 1px solid rgba(255,20,147,.24);
    border-radius: 12px;
    background: rgba(255,20,147,.08);
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    transition: .18s ease;
}

    .open-full-video-link:hover {
        border-color: rgba(255,20,147,.45);
        background: rgba(255,20,147,.18);
    }

.channel-name {
    margin-top: 10px;
    color: #aaaaaa;
    font-size: 14px;
}

.video-views {
    color: #aaaaaa;
    margin-top: 6px;
    font-size: 13px;
}

.description {
    margin-top: 12px;
    color: #cccccc;
    font-size: 14px;
    line-height: 1.6;
}

.empty-results {
    padding: 40px 20px;
    color: #aaaaaa;
    text-align: center;
    font-size: 18px;
}

/* =========================
   Downloads
   ========================= */

.download-box {
    margin-top: 18px;
}

.download-button {
    height: 38px;
    padding: 0 22px;
    border: 1px solid rgba(255,20,147,.35);
    border-radius: 20px;
    background: linear-gradient( 180deg, rgba(255,20,147,.24) 0%, rgba(255,20,147,.12) 100% );
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}

    .download-button:disabled,
    .download-quality:disabled {
        opacity: .55;
        cursor: not-allowed;
    }

.download-formats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.download-quality {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 86px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 18px;
    background: rgba(255,255,255,.06);
    color: white;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    font-family: inherit;
    font-size: 13px;
    text-decoration: none;
}

    .download-quality:hover {
        border-color: rgba(255,20,147,.45);
        background: rgba(255,20,147,.18);
    }

.download-message {
    color: #aaaaaa;
    font-size: 13px;
}

/* =========================
   Toast
   ========================= */

.download-toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    z-index: 9999;
    transform: translateX(-50%);
    min-width: 230px;
    max-width: calc(100vw - 32px);
    padding: 13px 18px;
    border: 1px solid rgba(255,20,147,.35);
    border-radius: 18px;
    background: rgba(15, 15, 15, .96);
    color: #ffffff;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 18px 60px rgba(0,0,0,.45), 0 0 36px rgba(255,20,147,.16);
}

    .download-toast::before {
        content: "";
        display: inline-block;
        width: 13px;
        height: 13px;
        margin-left: 8px;
        border: 2px solid rgba(255,255,255,.35);
        border-top-color: #ff1493;
        border-radius: 50%;
        vertical-align: -2px;
        animation: download-spin .75s linear infinite;
    }

@keyframes download-spin {
    to {
        transform: rotate(360deg);
    }
}


/* =========================
   Mini Player
   ========================= */

.mini-player {
    position: fixed;
    top: 18px;
    left: 18px;
    right: auto;
    bottom: auto;
    z-index: 950;
    width: 260px;
    overflow: hidden;
    border: 1px solid rgba(255,20,147,.28);
    border-radius: 16px;
    background: rgba(10,10,10,.96);
    color: white;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    box-shadow: 0 18px 60px rgba(0,0,0,.55), 0 0 36px rgba(255,20,147,.14);
    backdrop-filter: blur(14px);
}

.mini-player-video {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
}

.mini-player:active {
    cursor: grabbing;
}

.mini-player-video,
.mini-player button {
    cursor: auto;
    user-select: auto;
    -webkit-user-select: auto;
    touch-action: auto;
}


.mini-player-details {
    padding: 10px;
}

.mini-player-title {
    color: white;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.45;
    max-height: 38px;
    overflow: hidden;
}

.mini-player-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.mini-player-prev,
.mini-player-open,
.mini-player-pip,
.mini-player-next,
.mini-player-close {
    flex: 1 1 calc(33.333% - 8px);
    height: 32px;
    border: 1px solid rgba(255,20,147,.28);
    border-radius: 12px;
    background: rgba(255,20,147,.10);
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

    .mini-player-prev:hover,
    .mini-player-open:hover,
    .mini-player-pip:hover,
    .mini-player-next:hover,
    .mini-player-close:hover {
        border-color: rgba(255,20,147,.45);
        background: rgba(255,20,147,.18);
    }

/* =========================
   Video Page
   ========================= */

.video-page {
    box-sizing: border-box;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.custom-player-card {
    width: 100%;
    background: #050505;
    border-radius: 22px;
}

.mobile-player-topbar {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

.mobile-back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 110px;
    height: 42px;
    padding: 0 18px;
    border: 1px solid rgba(255,20,147,.32);
    border-radius: 22px;
    background: rgba(255,20,147,.10);
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    backdrop-filter: blur(10px);
}

.custom-video-player {
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: none;
    border: none;
    border-radius: 18px;
    background: black;
    box-shadow: 0 0 40px rgba(255,20,147,.08), 0 18px 60px rgba(0,0,0,.55);
}

.custom-player-actions {
    margin-top: 12px;
}

/* =========================
   Mobile
   ========================= */

@media (max-width: 768px) {

    .topbar {
        padding: 14px 12px 24px 12px;
    }

        .topbar.home-mode {
            min-height: calc(100dvh - 170px);
            padding-top: 0;
            padding-bottom: 80px;
        }

        .topbar.results-mode {
            padding-top: 8px;
            padding-bottom: 12px;
        }

    .youtube-logo-link {
        display: block;
        width: 100%;
        max-width: 360px;
        margin: 0 auto 18px auto;
    }

    .youtube-logo,
    .topbar.results-mode .youtube-logo {
        width: 100% !important;
        max-width: 360px !important;
        min-width: 280px;
        height: 115px !important;
        margin: 0 auto;
        border-radius: 20px;
    }

    .youtube-text,
    .topbar.results-mode .youtube-text {
        z-index: 3;
        bottom: 18px !important;
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: #ffffff !important;
        font-size: 44px !important;
        letter-spacing: -2px;
    }

    body:has(#resultsContainer .video-card) .topbar.home-mode {
        min-height: auto;
        justify-content: flex-start;
        padding-top: 8px;
        padding-bottom: 12px;
    }

        body:has(#resultsContainer .video-card) .topbar.home-mode .youtube-logo,
        .topbar.results-mode .youtube-logo {
            max-width: 300px !important;
            min-width: 240px;
            height: 86px !important;
            margin-bottom: 10px;
            border-radius: 16px;
        }

        body:has(#resultsContainer .video-card) .topbar.home-mode .youtube-text,
        .topbar.results-mode .youtube-text {
            bottom: 12px !important;
            font-size: 34px !important;
        }

    .youtube-text .brand-small {
        top: -0.9em;
    }

    .search-form {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }

    .search-input {
        width: 100%;
        height: 48px;
        font-size: 16px;
    }

    .search-button {
        width: 100%;
        height: 48px;
    }

    .watch-history-floating-button {
        position: fixed;
        right: 12px;
        bottom: 18px;
        top: auto;
        left: auto;
        z-index: 999;
        width: auto;
        max-width: 170px;
        height: 42px;
        padding: 0 16px;
        border-radius: 18px;
        font-size: 13px;
    }

    .watch-history-overlay {
        padding: 14px;
    }

    .watch-history-overlay-header {
        flex-direction: column;
        align-items: stretch;
    }

    .watch-history-overlay-actions {
        flex-direction: column;
    }

    .watch-history-close,
    .watch-history-clear {
        width: 100%;
        height: 42px;
    }

    .watch-history-list {
        grid-template-columns: 1fr;
    }

    .results {
        margin: 12px auto;
        padding: 0 12px;
    }

    .video-card {
        display: block;
        margin-bottom: 26px;
    }

    .thumbnail-container {
        width: 100%;
        margin-bottom: 12px;
    }

    .video-title {
        font-size: 17px;
        line-height: 1.5;
    }

    .description {
        font-size: 13px;
        line-height: 1.5;
    }

    .download-button {
        width: 100%;
        height: 42px;
    }

    .download-formats {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .download-quality {
        width: 100%;
        height: 38px;
    }

    .download-toast {
        bottom: 16px;
        width: calc(100vw - 32px);
    }


    .mini-player {
        top: 12px;
        left: 12px;
        right: auto;
        bottom: auto;
        width: 210px;
        border-radius: 14px;
        touch-action: none;
    }

    .mini-player-details {
        padding: 8px;
    }

    .mini-player-title {
        font-size: 12px;
        line-height: 1.4;
        max-height: 34px;
    }

    .mini-player-actions {
        gap: 6px;
        margin-top: 8px;
    }

    .mini-player-prev,
    .mini-player-open,
    .mini-player-pip,
    .mini-player-next,
    .mini-player-close {
        flex-basis: calc(33.333% - 6px);
        height: 30px;
        font-size: 10.5px;
        border-radius: 10px;
    }

    .video-page {
        max-width: none;
        margin: 0 auto;
        padding: 0;
    }

    .custom-player-card {
        padding: 0;
        border-radius: 0;
    }

    .mobile-player-topbar {
        margin-bottom: 8px;
        padding: 12px;
    }

    .mobile-back-button {
        width: 100%;
        height: 46px;
        border-radius: 14px;
        font-size: 15px;
    }

    .custom-video-player {
        width: 100%;
        max-height: 58vh;
        border-radius: 0;
        background: #000;
    }

    .custom-player-actions {
        margin-top: 12px;
    }

        .custom-player-actions .download-button {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 100%;
            height: 42px;
            text-decoration: none;
        }
    .special-welcome-banner {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%) translateY(-20px);
        background: rgba(15, 23, 42, 0.96);
        color: white;
        padding: 14px 22px;
        border-radius: 14px;
        font-size: 15px;
        font-weight: 600;
        z-index: 999999;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.35s ease, transform 0.35s ease;
        box-shadow: 0 10px 35px rgba(0, 0, 0, 0.35);
        border: 1px solid rgba(255,255,255,0.08);
        backdrop-filter: blur(10px);
    }

    .special-welcome-visible {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
