:root {
    --bg-color: #0d0d12;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent: #8b5cf6;
    --accent-hover: #7c3aed;
    --danger: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding: 80px 20px 40px;
}

/* Background Blobs for Glassmorphism */
.background-elements {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
}

.blob {
    position: absolute;
    filter: blur(80px);
    opacity: 0.5;
    border-radius: 50%;
    animation: float 20s infinite alternate;
}

.shape1 {
    width: 400px;
    height: 400px;
    background: #8b5cf6;
    top: -100px;
    left: -100px;
}

.shape2 {
    width: 300px;
    height: 300px;
    background: #3b82f6;
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

.shape3 {
    width: 250px;
    height: 250px;
    background: #ec4899;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(30px, 50px) scale(1.1);
    }
}

.container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    /* Force horizontal centering as a block */
    z-index: 1;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    gap: 32px;
}

header {
    text-align: center;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(to right, #e879f9, #ffbeeb);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}


.input-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

#url-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    border-radius: 14px;
    padding: 16px 56px 16px 20px;
    color: var(--text-primary);
    font-size: 1.05rem;
    outline: none;
    transition: all 0.3s ease;
}

#url-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

#url-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
    background: rgba(0, 0, 0, 0.4);
}

#paste-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#paste-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
}

.primary-btn,
.secondary-btn {
    width: 100%;
    padding: 16px;
    border-radius: 14px;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.primary-btn {
    background: var(--accent);
    color: white;
}

.primary-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(139, 92, 246, 0.5);
}

.primary-btn:active,
.secondary-btn:active {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: 1px solid var(--card-border);
}

.secondary-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.hidden {
    display: none !important;
}

.result-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-container {
    width: 100%;
    border-radius: 14px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.6);
    aspect-ratio: 9/16;
    max-height: 480px;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid var(--card-border);
}

video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    outline: none;
}

.loader {
    width: 22px;
    height: 22px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s linear infinite;
}

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

@media (max-width: 500px) {
    .container {
        padding: 24px;
        gap: 24px;
    }

}

/* Light Theme Override */
[data-theme="light"] {
    --bg-color: #f1f5f9;
    --card-bg: rgba(255, 255, 255, 0.6);
    --card-border: rgba(255, 255, 255, 0.4);
    --text-primary: #0f172a;
    --text-secondary: #475569;
}

[data-theme="light"] #url-input {
    background: rgba(255, 255, 255, 0.8);
    color: var(--text-primary);
}

[data-theme="light"] #url-input::placeholder {
    color: rgba(0, 0, 0, 0.5);
}

[data-theme="light"] .secondary-btn {
    background: rgba(255, 255, 255, 0.6);
    color: var(--text-primary);
}

[data-theme="light"] .preview-container {
    background: rgba(0, 0, 0, 0.1);
}

.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

[data-theme="light"] .theme-toggle:hover {
    background: rgba(255, 255, 255, 0.9);
}