/* ============================================================
   PIRANOT — UX Enhancements CSS v2.0
   Styles for progress bar, skeleton, search dropdown,
   floating share, back-to-top, font toggle, paywall, LGPD.
   ============================================================ */

/* ── 1. READING PROGRESS BAR ─────────────────────────── */
.pira-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--pira-blue, #0b3b8f) 0%, var(--pira-accent, #ffd200) 100%);
    z-index: 10000;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}

/* ── 2. SKELETON LOADING ──────────────────────────────── */
.pira-skeleton {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: 12px;
    background: var(--pira-surface, #f8f9fa);
    margin-bottom: 16px;
    animation: pira-shimmer 1.5s ease-in-out infinite;
}

.pira-skeleton__img {
    width: 120px;
    min-height: 90px;
    border-radius: 8px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: pira-shimmer-bg 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

.pira-skeleton__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.pira-skeleton__line {
    height: 12px;
    border-radius: 6px;
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: pira-shimmer-bg 1.5s ease-in-out infinite;
}

.pira-skeleton__line--badge {
    width: 60px;
    height: 10px;
}

.pira-skeleton__line--title {
    width: 80%;
    height: 16px;
}

.pira-skeleton__line--text {
    width: 95%;
}

.pira-skeleton__line--meta {
    width: 40%;
    height: 10px;
}

@keyframes pira-shimmer-bg {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.pira-skeleton-wrapper {
    display: grid;
    gap: 12px;
}

/* ── 3. SEARCH AUTOCOMPLETE ───────────────────────────── */
.pira-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--pira-surface, #fff);
    border: 1px solid var(--pira-border, #e2e8f0);
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    z-index: 999;
    max-height: 340px;
    overflow-y: auto;
}

.pira-search-dropdown__item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    text-decoration: none;
    color: var(--pira-text, #1e293b);
    border-bottom: 1px solid var(--pira-border, #f1f5f9);
    transition: background 0.15s;
}

.pira-search-dropdown__item:hover {
    background: var(--pira-bg, #f8f9fa);
}

.pira-search-dropdown__title {
    font-size: 14px;
    font-weight: 500;
    flex: 1;
    line-height: 1.3;
}

.pira-search-dropdown__date {
    font-size: 12px;
    color: var(--pira-muted, #94a3b8);
    margin-left: 12px;
    white-space: nowrap;
}

.pira-search-dropdown__empty {
    padding: 20px 16px;
    text-align: center;
    color: var(--pira-muted, #94a3b8);
    font-size: 13px;
}

/* ── 4. FONT SIZE TOGGLE ──────────────────────────────── */
.pira-font-controls {
    display: inline-flex;
    gap: 4px;
    background: var(--pira-surface, #f1f5f9);
    border-radius: 8px;
    padding: 4px;
    margin-bottom: 16px;
    float: right;
}

.pira-font-btn {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-family: var(--font-ui, 'Inter', sans-serif);
    font-weight: 600;
    font-size: 13px;
    color: var(--pira-text, #1e293b);
    cursor: pointer;
    transition: all 0.15s;
}

.pira-font-btn:hover {
    background: var(--pira-blue, #0b3b8f);
    color: #fff;
}

/* ── 5. BACK-TO-TOP ───────────────────────────────────── */
.pira-back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: var(--pira-blue, #0b3b8f);
    color: #fff;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(11, 59, 143, 0.3);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    z-index: 900;
}

.pira-back-to-top.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.pira-back-to-top:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(11, 59, 143, 0.4);
}

/* ── 6. FLOATING SHARE BAR ────────────────────────────── */
.pira-share-float {
    position: fixed;
    left: max(calc(50% - 600px), 16px);
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 800;
}

.pira-share-float__btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    color: #fff;
    transition: all 0.2s;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.pira-share-float__btn:hover {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.pira-share-float__btn--fb {
    background: #1877f2;
}

.pira-share-float__btn--tw {
    background: #14171a;
}

.pira-share-float__btn--wa {
    background: #25d366;
}

.pira-share-float__btn--copy {
    background: var(--pira-surface, #e2e8f0);
    color: var(--pira-text, #1e293b);
}

.pira-share-float__btn--copy.copied {
    background: #10b981;
    color: #fff;
}

@media (max-width: 1200px) {
    .pira-share-float {
        display: none;
    }
}

/* ── 7. STICKY SIDEBAR ────────────────────────────────── */
.pira-sidebar-sticky {
    position: sticky;
    top: 90px;
}

@media (max-width: 1024px) {
    .pira-sidebar-sticky {
        position: static;
    }
}

/* ── 8. LGPD COOKIE CONSENT ───────────────────────────── */
.pira-cookie-consent {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.97);
    color: #fff;
    z-index: 9999;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.pira-cookie-consent__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.pira-cookie-consent__text {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
    min-width: 280px;
}

.pira-cookie-consent__text svg {
    flex-shrink: 0;
    margin-top: 2px;
    stroke: var(--pira-accent, #ffd200);
}

.pira-cookie-consent__text p {
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
}

.pira-cookie-consent__text a {
    color: var(--pira-accent, #ffd200);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.pira-cookie-consent__actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.pira-cookie-consent__accept {
    background: var(--pira-accent, #ffd200);
    color: #000;
    border: none;
    padding: 8px 24px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.pira-cookie-consent__accept:hover {
    background: #ffe14d;
    transform: translateY(-1px);
}

.pira-cookie-consent__reject {
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.pira-cookie-consent__reject:hover {
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

/* ── 9. PAYWALL OVERLAY ───────────────────────────────── */
.pira-paywall-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to bottom, transparent 0%, rgba(255, 255, 255, 0.95) 30%, #fff 50%);
    padding: 80px 24px 32px;
    text-align: center;
    z-index: 10;
}

[data-theme="dark"] .pira-paywall-overlay {
    background: linear-gradient(to bottom, transparent 0%, rgba(15, 23, 42, 0.95) 30%, var(--pira-bg) 50%);
}

.pira-paywall-box {
    max-width: 440px;
    margin: 0 auto;
}

.pira-paywall-box svg {
    margin-bottom: 16px;
}

.pira-paywall-box h3 {
    font-family: var(--font-headline, 'Oswald', sans-serif);
    font-size: 1.3rem;
    margin-bottom: 16px;
    color: var(--pira-text, #1e293b);
}

.pira-paywall-btn {
    display: inline-block;
    background: linear-gradient(135deg, #0b3b8f, #1a56db);
    color: #fff;
    padding: 12px 36px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.2s;
    box-shadow: 0 4px 16px rgba(11, 59, 143, 0.3);
}

.pira-paywall-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(11, 59, 143, 0.4);
    color: #fff;
}

.pira-paywall-small {
    margin-top: 12px;
    font-size: 13px;
    color: var(--pira-muted, #94a3b8);
}

.pira-paywall-small a {
    color: var(--pira-blue, #0b3b8f);
}

/* ── 10. CARD HOVER MICRO-ANIMATIONS ──────────────────── */
.pira-card {
    transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.pira-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

.pira-card__image img {
    transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.pira-card:hover .pira-card__image img {
    transform: scale(1.04);
}

/* Badge pulse on hover */
.pira-card:hover .pira-badge {
    animation: pira-badge-pulse 0.6s ease;
}

@keyframes pira-badge-pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

    100% {
        transform: scale(1);
    }
}

/* ── 11. READING COMFORT ──────────────────────────────── */
.pira-article__content {
    font-size: 1.05rem;
    line-height: 1.85;
    letter-spacing: -0.005em;
    transition: font-size 0.2s ease;
}

.pira-article__content p {
    margin-bottom: 1.4em;
}

.pira-article__content h2 {
    margin-top: 2.5em;
    margin-bottom: 0.8em;
    padding-top: 0.5em;
    border-top: 1px solid var(--pira-border, #e2e8f0);
}

.pira-article__content blockquote {
    border-left: 4px solid var(--pira-blue, #0b3b8f);
    padding: 16px 20px;
    margin: 1.5em 0;
    background: var(--pira-surface, #f8f9fa);
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--pira-text, #374151);
}

.pira-article__content img {
    border-radius: 10px;
    margin: 1.5em 0;
}

.pira-article__content figcaption {
    font-size: 0.85rem;
    color: var(--pira-muted, #94a3b8);
    text-align: center;
    margin-top: -0.8em;
    margin-bottom: 1.5em;
}

/* ── 12. IMPROVED BREADCRUMB VISUAL ───────────────────── */
.pira-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-ui, 'Inter', sans-serif);
    font-size: 0.8rem;
    color: var(--pira-muted, #94a3b8);
    padding: 8px 0;
    flex-wrap: wrap;
}

.pira-breadcrumb a {
    color: var(--pira-blue, #0b3b8f);
    text-decoration: none;
    transition: color 0.15s;
}

.pira-breadcrumb a:hover {
    text-decoration: underline;
}

.pira-breadcrumb__sep {
    opacity: 0.4;
}

/* ── 13. DISCOVERY SECTION ────────────────────────────── */
.pira-section--discovery {
    display: none;
    /* shown by JS when data available */
    background: linear-gradient(135deg, #f0f4ff 0%, #fefce8 100%);
    border-radius: 16px;
    padding: 24px;
    margin: 24px 0;
}

[data-theme="dark"] .pira-section--discovery {
    background: linear-gradient(135deg, rgba(11, 59, 143, 0.1) 0%, rgba(255, 210, 0, 0.05) 100%);
}