@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.05); }
}
@keyframes spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* WP Rocket GPU hints */
.uvd-result-card  { will-change: transform, opacity; }
.uvd-message      { will-change: transform, opacity; }
.uvd-spinner      { will-change: transform; }
.uvd-submit-btn   { will-change: transform; }

/* =============================================================
   OUTER WRAP — neutral block, full width of page content area
============================================================= */
.uvd-wrap {
    width: 100%;
    padding-left: 0;
    padding-right: 0;
    box-sizing: border-box;
    overflow: visible;
}

/* =============================================================
   AD OUTER — direct children of .uvd-wrap, full content width
============================================================= */
.uvd-ad-outer {
    display: block;
    width: 100%;
    max-width: 100%;
    text-align: center;
    margin: 16px 0;
    padding: 0;
    box-sizing: border-box;
    overflow: visible;
}

/* Inner wrapper — lets AdSense measure the available width correctly */
.uvd-ad-inner {
    display: block;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    overflow: clip;
    box-sizing: border-box;
}

/* Force the ins tag and its iframe to respect the container */
.uvd-ad-inner ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}
.uvd-ad-inner ins.adsbygoogle iframe {
    max-width: 100% !important;
}

/* =============================================================
   THEME OVERRIDE PROTECTION — prevents theme CSS from clipping ads
============================================================= */
.uvd-wrap .uvd-ad-outer,
.uvd-wrap .uvd-ad-inner {
    overflow: visible !important;
    max-width: none !important;
    contain: none !important;
    float: none !important;
    clear: both !important;
}
.uvd-wrap .uvd-ad-inner ins.adsbygoogle {
    overflow: hidden !important; /* AdSense needs this on the ins itself */
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;
    float: none !important;
}
.uvd-wrap .uvd-ad-inner ins.adsbygoogle iframe {
    max-width: 100% !important;
    width: 100% !important;
}

/* Per-slot spacing overrides */
.uvd-ad1-outer { margin-bottom: 8px; }
.uvd-ad2-outer { margin-top: 8px;   margin-bottom: 0; }
.uvd-ad3-outer { margin-top: 0;     margin-bottom: 0; }
.uvd-ad4-outer { margin-top: 16px;  margin-bottom: 0; padding-bottom: 16px; }

/* =============================================================
   PLUGIN CARD (white container)
============================================================= */
.uvd-container {
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    padding: 20px 16px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
}

/* =============================================================
   HEADER
============================================================= */
.uvd-header {
    text-align: center;
    margin-bottom: 24px;
}
.uvd-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}
.uvd-icon svg { width: 32px; height: 32px; }
.uvd-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* =============================================================
   FORM
============================================================= */
.uvd-form-container { margin-bottom: 0; }
.uvd-form { display: flex; flex-direction: column; gap: 12px; }
.uvd-input-group {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.uvd-input {
    flex: 1;
    min-width: 0;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
    background: #f9fafb;
    color: #1f2937;
    box-sizing: border-box;
}
.uvd-input:focus { border-color: #667eea; background: #fff; }
.uvd-paste-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 16px;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 60px;
}
.uvd-paste-btn:hover { background: #e5e7eb; }
.uvd-paste-btn.success { background: #d1fae5; border-color: #10b981; color: #065f46; }
.uvd-paste-btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.uvd-submit-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
}
.uvd-submit-btn:hover  { transform: translateY(-1px); box-shadow: 0 8px 25px rgba(102,126,234,0.4); }
.uvd-submit-btn:active { transform: translateY(0); }
.uvd-submit-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }
.uvd-loading { display: flex; align-items: center; gap: 8px; }
.uvd-spinner {
    width: 20px; height: 20px;
    animation: spin 1s linear infinite;
}

/* =============================================================
   MESSAGES
============================================================= */
.uvd-message {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    margin: 16px 0;
    animation: fadeInUp 0.3s ease;
}
.uvd-message svg { width: 20px; height: 20px; flex-shrink: 0; }
.uvd-error   { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.uvd-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* =============================================================
   RESULT CARD
============================================================= */
.uvd-result-card {
    min-height: 250px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 12px;
    margin-top: 0;
    animation: fadeInUp 0.4s ease;
    box-sizing: border-box;
}
.uvd-result-card-continued {
    margin-top: 0;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-top: none;
}

/* =============================================================
   THUMBNAIL
============================================================= */
.uvd-thumbnail {
    display: block !important;
    text-align: center;
    margin-bottom: 16px;
}
.uvd-thumbnail img {
    width: auto !important;
    height: auto !important;
    max-width: 480px !important;
    max-height: 270px !important;
    object-fit: contain !important;
    border-radius: 12px;
    display: block;
    margin: 0 auto;
}

/* =============================================================
   VIDEO META
============================================================= */
.uvd-video-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 8px;
    line-height: 1.4;
}
.uvd-duration {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #6b7280;
    font-size: 13px;
    margin-bottom: 16px;
}
.uvd-duration svg { width: 16px; height: 16px; }

/* =============================================================
   DOWNLOAD SECTIONS
============================================================= */
.uvd-section { margin-bottom: 16px; }
.uvd-section-title {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    color: #374151;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.uvd-download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}
.uvd-download-item { align-self: start; }
.uvd-download-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px 10px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white !important;
    text-decoration: none !important;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    transition: transform 0.15s, box-shadow 0.15s;
    min-height: 44px;
    box-sizing: border-box;
    text-align: center;
}
.uvd-download-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(102,126,234,0.4);
    color: white !important;
    text-decoration: none !important;
}
.uvd-download-btn svg { width: 16px; height: 16px; flex-shrink: 0; }

/* =============================================================
   TRY ANOTHER
============================================================= */
.uvd-try-another { text-align: center; margin: 16px 0 8px; }
.uvd-try-another-btn {
    display: inline-block;
    padding: 10px 24px;
    min-height: 44px;
    line-height: 24px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
}
.uvd-try-another-btn:hover,
.uvd-try-another-btn:active {
    background: #e2e8f0;
    color: #1e293b;
    text-decoration: none;
}

/* =============================================================
   RESPONSIVE
============================================================= */
@media (max-width: 640px) {
    .uvd-container { padding: 16px 12px; }

    .uvd-download-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        align-items: start !important;
    }
    .uvd-download-item { width: 100%; align-self: start; }
    .uvd-download-btn  { font-size: 12px; padding: 12px 8px; border-radius: 10px; }
    .uvd-download-btn svg { width: 14px; height: 14px; }

    .uvd-section-title {
        font-size: 12px;
        padding: 6px 10px;
    }
    .uvd-result-card { padding: 10px 8px; }
    .uvd-thumbnail img { max-width: 100% !important; max-height: none !important; width: 100% !important; }
    .uvd-video-title { font-size: 1rem; }
}

@media (max-width: 480px) {
    .uvd-title  { font-size: 1.4rem; }
    .uvd-icon   { width: 52px; height: 52px; }
    .uvd-icon svg { width: 26px; height: 26px; }
    .uvd-download-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    .uvd-download-btn {
        font-size: 13px !important;
        padding: 11px 6px !important;
        min-height: 44px !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}
.uvd-title-seo-safe {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    text-align: center;
    line-height: 1.2;
}