/* Snapchat Downloader - Pill Search Bar v5.1 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --sc-yellow: #FFFC00;
    --sc-dark: #1c1c1e;
    --sc-blue: #0066FF;
    --sc-blue-hover: #0055DD;
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.5);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(255, 252, 0, 0.1);
    --primary-gradient: linear-gradient(135deg, #FFFC00 0%, #FFD700 50%, #FFA500 100%);
    --radius-lg: 20px;
    --radius-md: 14px;
    --radius-sm: 10px;
}

* {
    box-sizing: border-box;
}

.svd2-container {
    min-height: auto;
    padding: 0px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.svd2-box {
    background: none;
    border: none;
    border-radius: var(--radius-lg);
    padding: 36px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    box-shadow: none;
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.svd2-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 0;
    background: none;
    opacity: 0.6;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════
   SEARCH ROW
   ═══════════════════════════════════════════ */
.svd2-search-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.svd2-input-wrapper {
    position: relative;
    flex: 0 1 65%;
    display: flex;
    align-items: center;
}

/* ── Snapchat Ghost ── Emoji approach (theme-proof) ── */
.svd2-snap-ghost {
    position: absolute;
    left: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px !important;
    height: 38px !important;
    background: none !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    z-index: 2;
    flex-shrink: 0;
    box-shadow: none !important;
    font-size: 20px !important;
    line-height: 1 !important;
    text-align: center;
    pointer-events: none;
}

/* ── Input Field ── Pill Shape ── */
#svd2_url {
    width: 100%;
    padding: 15px 52px 15px 54px;
    font-size: 15px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
    outline: none;
    font-family: inherit;
    letter-spacing: -0.1px;
}

#svd2_url:focus {
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.05);
}

#svd2_url::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

/* ────────────────────────────────────────────
   PASTE / CLEAR BUTTON — CSS background-image
   No inline SVG needed, 100% theme-proof
   ──────────────────────────────────────────── */
.svd2-icon-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.1) !important;
    border: none !important;
    border-radius: 50% !important;
    width: 34px !important;
    height: 34px !important;
    display: block !important;
    cursor: pointer;
    z-index: 2;
    padding: 0 !important;
    transition: all 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    /* Paste clipboard icon via data URI */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2'/%3E%3Crect x='8' y='2' width='8' height='4' rx='1' ry='1'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: 16px 16px !important;
}

.svd2-icon-btn:hover {
    transform: translateY(-50%) scale(1.08);
    background-color: rgba(255, 255, 255, 0.18) !important;
}

.svd2-icon-btn:active {
    transform: translateY(-50%) scale(0.92);
}

/* When input has content — show X (clear) icon */
.svd2-icon-btn.has-content {
    background-color: rgba(255, 255, 255, 0.12) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E") !important;
}

.svd2-icon-btn.has-content:hover {
    background-color: rgba(255, 255, 255, 0.22) !important;
}

/* Hide any child elements inside button (cleanup) */
.svd2-icon-btn>* {
    display: none !important;
}

/* ── Download Button — Blue Pill ── */
.svd2-download-btn {
    padding: 15px 32px;
    font-size: 15px;
    font-weight: 700;
    background: #f9e150 !important;
    color: #000000 !important;
    border: none !important;
    border-radius: 50px !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
    box-shadow: none;
    font-family: inherit;
    white-space: nowrap;
    min-width: 150px;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    flex-shrink: 0;
}

.svd2-download-btn:hover {
    background: #f9e150 !important;
    transform: translateY(-1px);
    box-shadow: none;
}

.svd2-download-btn:active {
    transform: translateY(0) scale(0.98);
}

.svd2-download-btn:focus-visible {
    outline: 2px solid rgba(0, 102, 255, 0.5);
    outline-offset: 3px;
}

.svd2-download-btn.loading {
    background: #444 !important;
    color: #999 !important;
    cursor: not-allowed;
    pointer-events: none;
    box-shadow: none;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════
   PROGRESS BAR
   ═══════════════════════════════════════════ */
.svd2-progress-bar {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.svd2-progress-track {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.svd2-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sc-blue) 0%, #4dabff 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 102, 255, 0.4);
}

.svd2-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ═══════════════════════════════════════════
   STATUS MESSAGES
   ═══════════════════════════════════════════ */
.svd2-status {
    margin-top: 0;
    margin-bottom: 16px;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.svd2-status.show {
    opacity: 1;
    transform: translateY(0);
}

.svd2-status.loading {
    background: rgba(0, 102, 255, 0.08);
    color: #4dabff;
    border: 1px solid rgba(0, 102, 255, 0.2);
}

.svd2-status.success {
    background: rgba(0, 200, 83, 0.1);
    color: #00e676;
    border: 1px solid rgba(0, 200, 83, 0.25);
}

.svd2-status.error {
    background: rgba(255, 23, 68, 0.1);
    color: #ff5252;
    border: 1px solid rgba(255, 23, 68, 0.25);
}

/* ═══════════════════════════════════════════
   RESULT GRID
   ═══════════════════════════════════════════ */
.svd2-result {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

.svd2-item {
    background: rgba(255, 255, 255, 0.04);
    border-radius: var(--radius-md);
    padding: 16px;
    border: 1px solid var(--glass-border);
    animation: fadeInScale 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    transition: all 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.96);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.svd2-item:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 102, 255, 0.2);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(0, 102, 255, 0.05);
}

.svd2-media-wrapper {
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: #000;
    margin-bottom: 12px;
}

.svd2-item video,
.svd2-item img {
    width: 100%;
    display: block;
    border-radius: 0;
}

.svd2-item img {
    object-fit: cover;
}

.svd2-item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding: 0 2px;
}

.svd2-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.svd2-type-badge svg {
    width: 14px;
    height: 14px;
}

.svd2-item-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0.5;
}

/* Download Link */
.svd2-download {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f9e150 !important;
    color: #000000 !important;
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: none;
    width: 100%;
    cursor: pointer;
}

.svd2-download:hover {
    background: #f9e150 !important;
    transform: translateY(-2px);
    box-shadow: none;
    text-decoration: none;
    color: #000000 !important;
}

.svd2-download:active {
    transform: translateY(0);
}

.svd2-download svg {
    width: 18px;
    height: 18px;
    stroke: #000000;
    flex-shrink: 0;
}

/* Load More */
.svd2-load-more-container {
    text-align: center;
    margin-top: 24px;
}

.svd2-load-more-btn {
    padding: 14px 36px;
    font-size: 15px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: inherit;
}

.svd2-load-more-btn:hover {
    background: rgba(0, 102, 255, 0.1);
    border-color: rgba(0, 102, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.svd2-load-more-btn:active {
    transform: translateY(0);
}

/* ═══════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════ */
@media (max-width: 768px) {
    .svd2-result {
        grid-template-columns: 1fr;
    }

    .svd2-search-row {
        flex-direction: column;
        gap: 10px;
    }

    .svd2-input-wrapper {
        flex: none;
        width: 100%;
    }

    .svd2-download-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    .svd2-box {
        padding: 20px 16px;
        border-radius: 16px;
    }

    #svd2_url {
        padding: 13px 48px 13px 50px;
        font-size: 14px;
    }

    .svd2-snap-ghost {
        width: 34px !important;
        height: 34px !important;
        left: 5px;
        font-size: 17px !important;
    }

    .svd2-icon-btn {
        width: 30px !important;
        height: 30px !important;
        right: 8px;
        background-size: 14px 14px !important;
    }

    .svd2-download-btn {
        padding: 13px 20px;
        font-size: 14px;
        min-width: unset;
    }

    .svd2-item {
        padding: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}