:root {
    --bg-primary: #0a0e1a;
    --bg-card: rgba(26, 32, 53, 0.7);
    --fb-gradient: linear-gradient(135deg, #1877F2 0%, #6366f1 50%, #8b5cf6 100%);
    --accent-primary: #6366f1;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-subtle: rgba(148, 163, 184, 0.1);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', sans-serif;
    background-color: transparent;
    color: var(--text-primary);
}

.widget-container {
    width: 100%;
    min-height: 180px;
    padding: 24px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    background: radial-gradient(circle at top left, rgba(99, 102, 241, 0.1), transparent 70%),
                var(--bg-primary);
    transition: all 0.3s ease;
}

.header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.logo {
    width: 32px;
    height: 32px;
    background: var(--fb-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 14px;
}

h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.input-group {
    position: relative;
    display: flex;
    gap: 8px;
}

input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus {
    border-color: var(--accent-primary);
}

.btn-submit {
    background: var(--fb-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0 20px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.2s, filter 0.2s;
    white-space: nowrap;
}

.btn-submit:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Results Section */
#resultArea {
    display: none;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-subtle);
    animation: fadeIn 0.4s ease-out;
}

.video-card {
    display: flex;
    gap: 16px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 16px;
}

.video-thumb {
    width: 100px;
    height: 60px;
    border-radius: 6px;
    object-fit: cover;
    background: #1a2035;
}

.video-meta {
    flex: 1;
    min-width: 0;
}

.video-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-group {
    display: flex;
    gap: 8px;
}

.btn-dl {
    flex: 1;
    padding: 8px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    transition: all 0.2s;
}

.btn-hd { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.btn-sd { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }

.btn-dl:hover { filter: brightness(1.2); transform: translateY(-1px); }

.footer {
    margin-top: 16px;
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.error-msg {
    display: none;
    color: #ef4444;
    font-size: 12px;
    margin-top: 8px;
}
