/* ============================================
   Pinterest Video Downloader - Plugin Styles
   ============================================ */

:root {
    --pvd-primary: #E60023;
    --pvd-primary-dark: #C4001D;
    --pvd-primary-light: #FF4D6A;
    --pvd-bg: #FFFFFF;
    --pvd-bg-alt: #F7F7F7;
    --pvd-bg-card: #FFFFFF;
    --pvd-text: #1A1A2E;
    --pvd-text-muted: #6B7280;
    --pvd-border: #E5E7EB;
    --pvd-radius: 16px;
    --pvd-radius-sm: 10px;
    --pvd-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
    --pvd-shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.10);
    --pvd-transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --pvd-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Reset within widget */
.pvd-wrapper,
.pvd-wrapper * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.pvd-wrapper {
    font-family: var(--pvd-font);
    color: var(--pvd-text);
    max-width: 780px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* ---- Tool Section ---- */
.pvd-tool-section {
    background: var(--pvd-bg-card);
    border: 1px solid var(--pvd-border);
    border-radius: var(--pvd-radius);
    padding: 2.5rem 2rem 2rem;
    text-align: center;
    box-shadow: var(--pvd-shadow);
}

.pvd-icon-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--pvd-primary), var(--pvd-primary-light));
    border-radius: 14px;
    color: #fff;
    margin-bottom: 1rem;
    box-shadow: 0 4px 16px rgba(230, 0, 35, 0.25);
}

.pvd-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--pvd-text);
    margin-bottom: 0.35rem;
    line-height: 1.25;
}

.pvd-subtitle {
    font-size: 0.95rem;
    color: var(--pvd-text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* ---- Input Group ---- */
.pvd-input-group {
    display: flex;
    gap: 0.6rem;
    max-width: 620px;
    margin: 0 auto;
}

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

.pvd-input-icon {
    position: absolute;
    left: 14px;
    color: var(--pvd-text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.pvd-url-input {
    width: 100%;
    padding: 0.85rem 2.8rem 0.85rem 2.8rem;
    border: 2px solid var(--pvd-border);
    border-radius: var(--pvd-radius-sm);
    font-size: 0.95rem;
    font-family: var(--pvd-font);
    color: var(--pvd-text);
    background: var(--pvd-bg);
    outline: none;
    transition: border-color var(--pvd-transition), box-shadow var(--pvd-transition);
}

.pvd-url-input:focus {
    border-color: var(--pvd-primary);
    box-shadow: 0 0 0 3px rgba(230, 0, 35, 0.1);
}

.pvd-url-input::placeholder {
    color: #B0B0B0;
}

.pvd-paste-btn {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    color: var(--pvd-text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background var(--pvd-transition), color var(--pvd-transition);
}

.pvd-paste-btn:hover {
    background: var(--pvd-bg-alt);
    color: var(--pvd-primary);
}

.pvd-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0 1.6rem;
    background: var(--pvd-primary);
    color: #fff;
    border: none;
    border-radius: var(--pvd-radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--pvd-font);
    cursor: pointer;
    transition: background var(--pvd-transition), transform var(--pvd-transition), box-shadow var(--pvd-transition);
    white-space: nowrap;
}

.pvd-download-btn:hover {
    background: var(--pvd-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(230, 0, 35, 0.3);
}

.pvd-download-btn:active {
    transform: translateY(0);
}

.pvd-download-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.pvd-hint {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #9CA3AF;
}

/* ---- Loading ---- */
.pvd-loading {
    padding: 2rem 0 0.5rem;
    text-align: center;
}

.pvd-spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid var(--pvd-border);
    border-top-color: var(--pvd-primary);
    border-radius: 50%;
    animation: pvd-spin 0.7s linear infinite;
    margin-bottom: 0.75rem;
}

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

.pvd-loading p {
    font-size: 0.9rem;
    color: var(--pvd-text-muted);
}

/* ---- Error ---- */
.pvd-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    background: #FEF2F2;
    border: 1px solid #FECACA;
    border-radius: var(--pvd-radius-sm);
    color: #B91C1C;
    font-size: 0.88rem;
}

.pvd-error svg {
    flex-shrink: 0;
}

/* ---- Results ---- */
.pvd-results {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--pvd-border);
}

.pvd-preview-area {
    margin-bottom: 1rem;
}

.pvd-preview-container img,
.pvd-preview-container video {
    max-width: 100%;
    max-height: 360px;
    border-radius: var(--pvd-radius-sm);
    object-fit: contain;
    background: #F0F0F0;
}

.pvd-media-info {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.65rem;
}

.pvd-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: #F3F4F6;
    color: #4B5563;
}

.pvd-badge-quality {
    background: #ECFDF5;
    color: #059669;
}

/* ---- Download Options ---- */
.pvd-download-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pvd-dl-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--pvd-bg-alt);
    border: 1px solid var(--pvd-border);
    border-radius: var(--pvd-radius-sm);
    transition: border-color var(--pvd-transition), background var(--pvd-transition);
}

.pvd-dl-option:hover {
    border-color: var(--pvd-primary);
    background: #FFF5F5;
}

.pvd-dl-option-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.pvd-dl-option-info .pvd-quality-label {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--pvd-text);
}

.pvd-dl-option-info .pvd-format-label {
    font-size: 0.78rem;
    color: var(--pvd-text-muted);
    padding: 0.15rem 0.5rem;
    background: #E5E7EB;
    border-radius: 4px;
}

.pvd-dl-option-info .pvd-quality-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    color: #fff;
    background: #059669;
}

.pvd-dl-option-info .pvd-quality-badge.pvd-badge-hd {
    background: #2563EB;
}

.pvd-dl-option-info .pvd-quality-badge.pvd-badge-fhd {
    background: var(--pvd-primary);
}

.pvd-dl-btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.1rem;
    background: var(--pvd-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--pvd-font);
    cursor: pointer;
    text-decoration: none;
    transition: background var(--pvd-transition);
}

.pvd-dl-btn-sm:hover {
    background: var(--pvd-primary-dark);
    color: #fff;
    text-decoration: none;
}

/* ---- Features Bar ---- */
.pvd-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.pvd-feature {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 1rem;
    background: var(--pvd-bg-card);
    border: 1px solid var(--pvd-border);
    border-radius: var(--pvd-radius-sm);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.pvd-feature svg {
    flex-shrink: 0;
    color: var(--pvd-primary);
    margin-top: 2px;
}

.pvd-feature strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--pvd-text);
    margin-bottom: 0.15rem;
}

.pvd-feature span {
    font-size: 0.78rem;
    color: var(--pvd-text-muted);
    line-height: 1.35;
}

/* ---- How To Steps ---- */
.pvd-howto {
    margin-top: 2rem;
    padding: 2rem;
    background: var(--pvd-bg-card);
    border: 1px solid var(--pvd-border);
    border-radius: var(--pvd-radius);
    box-shadow: var(--pvd-shadow);
}

.pvd-howto h3 {
    font-size: 1.25rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--pvd-text);
}

.pvd-steps {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.pvd-step {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.pvd-step-number {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--pvd-primary), var(--pvd-primary-light));
    color: #fff;
    border-radius: 10px;
    font-weight: 800;
    font-size: 1rem;
}

.pvd-step-content h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--pvd-text);
    margin-bottom: 0.25rem;
}

.pvd-step-content p {
    font-size: 0.88rem;
    color: var(--pvd-text-muted);
    line-height: 1.55;
}

.pvd-step-content strong {
    color: var(--pvd-text);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .pvd-tool-section {
        padding: 1.5rem 1.25rem 1.25rem;
    }

    .pvd-title {
        font-size: 1.35rem;
    }

    .pvd-input-group {
        flex-direction: column;
    }

    .pvd-download-btn {
        justify-content: center;
        padding: 0.85rem;
    }

    .pvd-features {
        grid-template-columns: repeat(2, 1fr);
    }

    .pvd-howto {
        padding: 1.25rem;
    }
}

@media (max-width: 480px) {
    .pvd-features {
        grid-template-columns: 1fr;
    }

    .pvd-dl-option {
        flex-direction: column;
        gap: 0.6rem;
        align-items: stretch;
    }

    .pvd-dl-option-info {
        justify-content: center;
    }

    .pvd-dl-btn-sm {
        justify-content: center;
    }
}
