/* =========================================================
   Pixabay Video Finder — stili dedicati
   Palette: bg #0a0a0a · card #111/#1a1a1a · accent #0066cc / #00d2ff
   ========================================================= */

/* ── Critical fix: prevent display:flex from overriding [hidden] ── */
[hidden] {
    display: none !important;
}

/* ── Active nav link ── */
.nav-active {
    color: #fff !important;
    position: relative;
}
.nav-active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    right: 0;
    height: 2px;
    background: #00d2ff;
    border-radius: 2px;
}

/* ── Logged-in username in nav ── */
.nav-username {
    color: #666;
    font-size: 14px;
    cursor: default;
    user-select: none;
}

.nav-logout {
    color: #555 !important;
    font-size: 14px;
    transition: color 0.2s;
}
.nav-logout:hover { color: #ff6b6b !important; }

/* ================================================================
   HEADER / SEARCH
   ================================================================ */
.pf-header {
    padding: 130px 40px 64px;
    background:
        radial-gradient(ellipse 80% 50% at 50% -10%, rgba(0, 102, 204, 0.18), transparent),
        #0a0a0a;
    text-align: center;
    border-bottom: 1px solid #1a1a1a;
}

.pf-header-inner {
    max-width: 860px;
    margin: 0 auto;
}

.pf-title {
    font-size: 46px;
    font-weight: 700;
    letter-spacing: -1.5px;
    line-height: 1.12;
    margin: 20px 0 18px;
    color: #fff;
}

.pf-subtitle {
    font-size: 17px;
    color: #999;
    max-width: 600px;
    margin: 0 auto 36px;
    line-height: 1.65;
}

/* ── Search bar ── */
.pf-search-bar {
    display: flex;
    gap: 10px;
    max-width: 620px;
    margin: 0 auto 24px;
}

.pf-search-input {
    flex: 1;
    padding: 15px 20px;
    background: #111;
    border: 1px solid #2a2a2a;
    border-radius: 8px;
    color: #fff;
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pf-search-input::placeholder { color: #555; }

.pf-search-input:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
}

.pf-search-btn {
    padding: 15px 28px;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 8px;
}

/* ── Filters ── */
.pf-filters-row {
    display: flex;
    gap: 20px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 30px;
}

.pf-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #777;
    user-select: none;
}

.pf-filter select {
    background: #111;
    border: 1px solid #2a2a2a;
    color: #ccc;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.pf-filter select:hover,
.pf-filter select:focus { border-color: #0066cc; }

.pf-filter-checkbox { cursor: pointer; }

.pf-filter-checkbox input {
    width: 15px;
    height: 15px;
    accent-color: #0066cc;
    cursor: pointer;
}

/* ── Preset chips ── */
.pf-chips {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pf-chip {
    padding: 7px 15px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    color: #aaa;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.pf-chip:hover {
    background: rgba(0, 210, 255, 0.1);
    border-color: rgba(0, 210, 255, 0.35);
    color: #00d2ff;
    transform: translateY(-1px);
}

.pf-chip.active {
    background: rgba(0, 102, 204, 0.85);
    border-color: #0066cc;
    color: #fff;
}

/* ================================================================
   RESULTS SECTION
   ================================================================ */
.pf-results-section {
    padding: 40px 40px 120px;
    max-width: 1340px;
    margin: 0 auto;
}

.pf-results-meta {
    text-align: center;
    color: #555;
    font-size: 13px;
    margin-bottom: 32px;
    min-height: 18px;
    letter-spacing: 0.2px;
}

/* ── Grid ── */
.pf-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

/* ================================================================
   VIDEO CARD
   ================================================================ */
.pf-card {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s;
    cursor: pointer;
    position: relative;
}

.pf-card:hover {
    border-color: rgba(0, 102, 204, 0.6);
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 102, 204, 0.2);
}

/* ── Card media ── */
.pf-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #0d0d0d;
    overflow: hidden;
}

.pf-card-media img,
.pf-card-media video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.pf-card-media video {
    opacity: 0;
    transition: opacity 0.25s;
}

.pf-card-media.is-playing video { opacity: 1; }

/* Play overlay */
.pf-card-media::after {
    content: '▶';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: rgba(255,255,255,0.7);
    background: rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

.pf-card:hover .pf-card-media:not(.is-playing)::after { opacity: 1; }

/* Badges */
.pf-card-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
    backdrop-filter: blur(4px);
}

.pf-card-res {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 102, 204, 0.85);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    backdrop-filter: blur(4px);
}

/* ── Card body ── */
.pf-card-body {
    padding: 14px 16px 16px;
}

.pf-card-tags {
    color: #666;
    font-size: 12px;
    margin-bottom: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

.pf-card-tags span {
    color: rgba(0, 210, 255, 0.7);
    margin-right: 2px;
}

.pf-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.pf-card-user {
    font-size: 11px;
    color: #555;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 55%;
}

.pf-card-hint {
    font-size: 11px;
    color: #444;
    white-space: nowrap;
    transition: color 0.2s;
}

.pf-card:hover .pf-card-hint { color: #0066cc; }

/* Download buttons — modal only */
.pf-dl-btn {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    color: #bbb;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.18s;
    white-space: nowrap;
}

.pf-dl-btn:hover {
    background: #0066cc;
    border-color: #0066cc;
    color: #fff;
}

.pf-dl-btn.downloading {
    background: #004499;
    border-color: #004499;
    color: #88bbff;
    cursor: wait;
}

/* Guest sign-in prompt inside download area */
.pf-dl-btn.pf-dl-login {
    border-color: rgba(0, 210, 255, 0.3);
    color: #00d2ff;
    background: rgba(0, 210, 255, 0.07);
}
.pf-dl-btn.pf-dl-login:hover {
    background: rgba(0, 210, 255, 0.18);
    border-color: rgba(0, 210, 255, 0.6);
    color: #fff;
}

/* ================================================================
   STATES: loading / empty / error
   ================================================================ */
.pf-state {
    text-align: center;
    padding: 80px 20px;
    color: #666;
}

/* Spinner */
.pf-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #1e1e1e;
    border-top-color: #0066cc;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: pf-spin 0.75s linear infinite;
}

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

.pf-loading p {
    font-size: 14px;
    color: #666;
    letter-spacing: 0.3px;
}

/* Empty */
.pf-empty-icon,
.pf-error-icon {
    font-size: 40px;
    margin-bottom: 16px;
    display: block;
}

.pf-empty p {
    font-size: 16px;
    color: #777;
    margin-bottom: 6px;
}

.pf-empty-sub {
    font-size: 13px !important;
    color: #555 !important;
}

/* Error */
.pf-error p {
    color: #e06060;
    font-size: 15px;
    margin-bottom: 20px;
}

.pf-retry-btn {
    font-size: 13px;
    padding: 10px 24px;
    border-radius: 6px;
}

/* Load more */
.pf-load-more-wrap {
    text-align: center;
    margin-top: 48px;
}

.pf-load-more {
    padding: 14px 40px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    min-width: 200px;
    transition: all 0.2s;
}

.pf-load-more:hover:not(:disabled) {
    border-color: #0066cc;
    color: #0066cc;
}

.pf-load-more:disabled {
    opacity: 0.45;
    cursor: wait;
}

/* ================================================================
   MODAL
   ================================================================ */
.pf-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Overrides display:flex when hidden attr is present */
.pf-modal[hidden] {
    display: none !important;
}

.pf-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.pf-modal-content {
    position: relative;
    background: #111;
    border: 1px solid #222;
    border-radius: 14px;
    max-width: 860px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    z-index: 1;
    box-shadow: 0 40px 100px rgba(0,0,0,0.7), 0 0 0 1px rgba(255,255,255,0.05);
    animation: pf-modal-in 0.22s ease;
}

@keyframes pf-modal-in {
    from { opacity: 0; transform: scale(0.96) translateY(10px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Scrollbar inside modal */
.pf-modal-content::-webkit-scrollbar { width: 5px; }
.pf-modal-content::-webkit-scrollbar-track { background: #111; }
.pf-modal-content::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

.pf-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(255,255,255,0.08);
    color: #ccc;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.18s;
}

.pf-modal-close:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-color: rgba(255,255,255,0.2);
}

/* Video wrap */
.pf-modal-video-wrap {
    background: #000;
    border-radius: 14px 14px 0 0;
    overflow: hidden;
    position: relative;
}

.pf-modal-video {
    width: 100%;
    max-height: 58vh;
    display: block;
    background: #000;
}

/* Info section */
.pf-modal-info {
    padding: 22px 26px 26px;
}

.pf-modal-tags {
    color: rgba(0, 210, 255, 0.75);
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.6;
    word-break: break-word;
}

.pf-modal-meta {
    color: #666;
    font-size: 12px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pf-modal-meta-sep {
    color: #333;
}

.pf-modal-dl-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}

.pf-modal-downloads {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.pf-modal-downloads .pf-dl-btn {
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 6px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
}

.pf-modal-downloads .pf-dl-btn:hover {
    background: #0066cc;
    border-color: #0066cc;
    color: #fff;
}

/* ── Save-to-library section ── */
.pf-modal-save-section {
    margin-bottom: 18px;
}

.pf-modal-save-divider {
    height: 1px;
    background: #1e1e1e;
    margin: 18px 0 14px;
}

/* ── Quota summary line ── */
.pf-modal-quota {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.pf-qi { color: #666; }

.pf-qi-sep { color: #2e2e2e; }

.pf-qi-plan {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #555;
}

.pf-qi-pro {
    background: linear-gradient(135deg, rgba(0,102,204,0.22), rgba(0,210,255,0.12));
    border-color: rgba(0,210,255,0.35);
    color: #00d2ff;
}

/* ── Limit / upgrade message ── */
.pf-save-limit-msg {
    font-size: 12px;
    color: #e06060;
    line-height: 1.55;
    margin: 6px 0 4px;
}

.pf-save-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 10px;
}

/* ── Per-resolution save buttons row ── */
.pf-save-buttons-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.pf-save-res-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #1a1a1a;
    border: 1px solid rgba(0,210,255,0.2);
    border-radius: 6px;
    color: #00d2ff;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s;
    white-space: nowrap;
}

.pf-save-res-btn:hover:not(:disabled) {
    background: rgba(0,102,204,0.22);
    border-color: rgba(0,210,255,0.5);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,210,255,0.12);
}

.pf-save-res-btn:disabled {
    opacity: 0.4;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.pf-save-size {
    color: #555;
    font-weight: 400;
    font-size: 11px;
}

.pf-save-res-btn:hover:not(:disabled) .pf-save-size {
    color: rgba(255,255,255,0.5);
}

/* ── Progress feedback (shared, below all buttons) ── */
.pf-modal-save-feedback {
    margin-top: 10px;
}

.pf-modal-save-bar-wrap {
    height: 3px;
    background: #1e1e1e;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 7px;
}

.pf-modal-save-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0066cc, #00d2ff);
    border-radius: 3px;
    transition: width 0.25s ease;
}

.pf-modal-save-status {
    font-size: 12px;
    line-height: 1.5;
    color: #666;
}

.pf-modal-save-status.pf-save-active  { color: #00d2ff; }
.pf-modal-save-status.pf-save-success { color: #00cc66; }
.pf-modal-save-status.pf-save-error   { color: #e06060; }

.pf-modal-save-status a.pf-save-link,
.pf-save-limit-msg a.pf-save-link {
    color: #00d2ff;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pf-modal-save-status a.pf-save-link:hover,
.pf-save-limit-msg a.pf-save-link:hover {
    color: #fff;
}

/* ── Pixabay link ── */
.pf-modal-pixabay-link {
    color: #555;
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: color 0.18s;
}

.pf-modal-pixabay-link:hover { color: #00d2ff; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 768px) {
    .pf-header {
        padding: 100px 20px 48px;
    }

    .pf-title {
        font-size: 30px;
        letter-spacing: -0.5px;
    }

    .pf-subtitle {
        font-size: 15px;
    }

    .pf-search-bar {
        flex-direction: column;
    }

    .pf-search-btn {
        width: 100%;
        justify-content: center;
    }

    .pf-filters-row {
        gap: 12px;
    }

    .pf-results-section {
        padding: 24px 16px 80px;
    }

    .pf-results-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .pf-modal-content {
        border-radius: 10px;
    }

    .pf-modal-video {
        max-height: 38vh;
    }

    .pf-modal-info {
        padding: 16px 18px 20px;
    }
}

@media (max-width: 480px) {
    .pf-title { font-size: 26px; }
    .pf-chips { gap: 6px; }
    .pf-chip { font-size: 11px; padding: 6px 12px; }
}

/* ================================================================
   SEO CONTENT SECTION
   ================================================================ */
.pf-seo-section {
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    padding: 80px 40px;
}

.pf-seo-inner {
    max-width: 1200px;
    margin: 0 auto;
}

.pf-seo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
    margin-bottom: 72px;
}

.pf-seo-card {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    padding: 28px;
}

.pf-seo-card h2 {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 12px;
    letter-spacing: -0.3px;
}

.pf-seo-card p {
    font-size: 14px;
    color: #777;
    line-height: 1.7;
}

.pf-seo-card strong {
    color: #aaa;
}

/* FAQ */
.pf-faq-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 28px;
    letter-spacing: -0.5px;
    text-align: center;
}

.pf-faq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.pf-faq-item {
    background: #111;
    border: 1px solid #1e1e1e;
    border-radius: 10px;
    padding: 24px;
}

.pf-faq-item h3 {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.4;
}

.pf-faq-item p {
    font-size: 14px;
    color: #777;
    line-height: 1.65;
}

/* ================================================================
   CTA SECTION (for non-logged-in users)
   ================================================================ */
.pf-cta-section {
    padding: 80px 40px;
    background: radial-gradient(circle at 50% 50%, rgba(0, 102, 204, 0.12), transparent 65%), #0a0a0a;
    text-align: center;
    border-top: 1px solid #1a1a1a;
}

.pf-cta-inner {
    max-width: 540px;
    margin: 0 auto;
}

.pf-cta-inner h2 {
    font-size: 36px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
    letter-spacing: -0.8px;
}

.pf-cta-inner p {
    font-size: 16px;
    color: #888;
    margin-bottom: 32px;
    line-height: 1.6;
}

/* Responsive SEO + CTA */
@media (max-width: 900px) {
    .pf-seo-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .pf-faq-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

@media (max-width: 768px) {
    .pf-seo-section { padding: 56px 20px; }
    .pf-seo-section .pf-seo-grid { margin-bottom: 48px; }
    .pf-faq-title { font-size: 22px; }
    .pf-cta-section { padding: 60px 20px; }
    .pf-cta-inner h2 { font-size: 26px; }
}