/* ============================================
   Pricing Page Styles
   ============================================ */

.pricing-page {
    padding-top: 100px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 50%, var(--bg-secondary) 100%);
}

.pricing-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(var(--color-primary-rgb), 0.05) 0%, transparent 50%);
    animation: pulse-bg 15s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

/* Animated background orbs */
.pricing-background {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 100%;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

/* Hero content needs z-index above the orbs */
.pricing-hero > .container {
    position: relative;
    z-index: 1;
}

/* Hero */
.pricing-hero {
    text-align: center;
    padding: 4rem 1rem 2rem;
    position: relative;
}

.pricing-badge {
    display: inline-block;
    padding: 6px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

.pricing-hero-title {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

.pricing-hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 2rem;
    line-height: 1.6;
}

/* Billing Toggle */
.billing-toggle {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 8px 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 40px;
}

.billing-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.billing-label.active {
    color: var(--text-primary);
}

.toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--border-color);
    border-radius: 26px;
    transition: background 0.3s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #667eea, #764ba2);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(22px);
}

.billing-save-badge {
    font-size: 0.75rem;
    font-weight: 700;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    padding: 3px 10px;
    border-radius: 12px;
}

/* Product Tabs */
.pricing-tabs-section {
    padding: 0 1rem;
    margin-top: -0.5rem;
}

.product-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 2rem;
}

.product-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.product-tab:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.product-tab.active {
    color: white;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
}

.product-tab.active svg {
    stroke: white;
}

.product-content {
    display: none;
}

.product-content.active {
    display: block;
}

/* Pricing Cards Section */
.pricing-cards-section {
    padding: 1rem 1rem 3rem;
}

.pricing-section-intro {
    text-align: center;
    margin-bottom: 2.5rem;
}

.pricing-section-intro h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.pricing-section-intro p {
    font-size: 1rem;
    color: var(--text-secondary);
    max-width: 550px;
    margin: 0 auto;
}

.pricing-grid {
    display: grid;
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.pricing-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.pricing-grid-free {
    grid-template-columns: repeat(3, 1fr);
    margin-top: 2.5rem;
}

.pricing-grid-free .pricing-card {
    grid-column: 2;
}

@media (max-width: 900px) {
    .pricing-grid-3 {
        grid-template-columns: 1fr;
        max-width: 420px;
    }
    .pricing-grid-free {
        grid-template-columns: 1fr;
        max-width: 420px;
    }
    .pricing-grid-free .pricing-card {
        grid-column: 1;
    }
}

/* Pricing Card */
.pricing-card {
    position: relative;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}

.pricing-card-featured {
    transform: scale(1.03);
}

.pricing-card-featured:hover {
    transform: scale(1.03) translateY(-4px);
}

.featured-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 20px;
    white-space: nowrap;
}

/* Anchor highlight overlay — temporary pulse on navigation */
.pricing-card-highlight {
    position: relative;
}

.pricing-card-highlight::after {
    content: '';
    position: absolute;
    inset: -3px;
    border: 2.5px solid var(--color-primary, #2563eb);
    border-radius: 18px;
    pointer-events: none;
    animation: card-highlight-pulse 2.5s ease-out forwards;
}

@keyframes card-highlight-pulse {
    0% { opacity: 0; transform: scale(0.98); }
    15% { opacity: 1; transform: scale(1); }
    70% { opacity: 1; }
    100% { opacity: 0; }
}

/* Active column highlight in comparison table (temporary) */
.comparison-table .active-col {
    background: rgba(37, 99, 235, 0.08);
    transition: background 0.5s ease;
}

.comparison-table .active-col-fade {
    background: transparent;
}

[data-theme="dark"] .comparison-table .active-col {
    background: rgba(37, 99, 235, 0.12);
}

.pricing-card-enterprise {
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-style: dashed;
}

/* Card Header */
.pricing-card-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.plan-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.plan-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.plan-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Price */
.pricing-card-price {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.price-amount {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.price-period {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.price-billed {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    min-height: 1.2em;
}

/* Feature List */
.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 0.5rem;
    flex: 1 1 auto;
}

.plan-features-collapsible li:nth-child(n+6) {
    display: none;
}

.plan-features-collapsible.expanded li:nth-child(n+6) {
    display: flex;
}

.features-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--color-primary, #2563eb);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    padding: 0 0 1rem;
    margin: 0;
    line-height: 1;
}

.features-toggle svg {
    transition: transform 0.2s;
}

.features-toggle[aria-expanded="true"] svg {
    transform: rotate(180deg);
}


.plan-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 0;
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.plan-features li.highlight {
    font-weight: 600;
}

.plan-features li svg {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.check-icon {
    stroke: #10b981;
}

.x-icon {
    stroke: var(--text-muted);
    opacity: 0.4;
}

.feature-excluded {
    color: var(--text-muted);
    opacity: 0.6;
}

/* Plan Button */
.btn-plan {
    width: 100%;
    padding: 14px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 12px;
    text-align: center;
    text-decoration: none;
    display: block;
    margin-top: auto;
}

.plan-trial-note {
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

/* ============================================
   Comparison Table
   ============================================ */
.comparison-section {
    padding: 4rem 1rem;
    background: rgba(var(--color-primary-rgb), 0.03);
    backdrop-filter: blur(2px);
}

.section-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 2rem;
}

.comparison-table-wrapper {
    max-width: 900px;
    margin: 0 auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}

.comparison-table th,
.comparison-table td {
    padding: 12px 16px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.comparison-table th {
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-primary);
    position: sticky;
    top: 0;
    z-index: 2;
}

.comparison-table .feature-col {
    text-align: left;
    min-width: 200px;
}

.comparison-table td:first-child {
    text-align: left;
    color: var(--text-primary);
    font-weight: 500;
}

.comparison-table .highlight-col {
    background: rgba(102, 126, 234, 0.08);
}

.comparison-table td:nth-child(3) {
    background: rgba(102, 126, 234, 0.04);
}

.category-row td {
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-primary);
    background: var(--bg-secondary);
    padding-top: 20px;
}

/* ============================================
   FAQ Section
   ============================================ */
.faq-section {
    padding: 4rem 1rem;
}

.faq-grid {
    max-width: 750px;
    margin: 0 auto;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    gap: 12px;
}

.faq-question:hover {
    color: var(--color-primary);
}

.faq-arrow {
    flex-shrink: 0;
    stroke: var(--text-secondary);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    transition: transform 0.3s;
}

.faq-item.open .faq-arrow {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 300px;
    padding-bottom: 18px;
}

.faq-answer p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.faq-answer a {
    color: var(--color-primary);
}

/* ============================================
   CTA Section
   ============================================ */
.pricing-cta {
    padding: 3rem 1rem 4rem;
}

/* Cross-link between reader/publisher pricing pages */
.pricing-cross-link {
    margin-top: 1.25rem;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.pricing-cross-link a {
    color: var(--color-primary);
    font-weight: var(--font-weight-medium);
    text-decoration: none;
}

.pricing-cross-link a:hover {
    text-decoration: underline;
}

.cta-card {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    color: white;
}

.cta-card h2 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.75rem;
}

.cta-card p {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0 0 1.5rem;
}

.cta-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.cta-buttons .btn-primary {
    background: white;
    color: #667eea !important;
}

.cta-buttons .btn-primary:hover {
    background: #f0f0f0;
    color: #5a3d9e !important;
}

.cta-buttons .btn-outline {
    border-color: rgba(255,255,255,0.5);
    color: white;
}

.cta-buttons .btn-outline:hover {
    background: rgba(255,255,255,0.15);
    border-color: white;
}

/* ============================================
   Container
   ============================================ */
.pricing-page .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   Dark Mode Adjustments
   ============================================ */
[data-theme="dark"] .pricing-card {
    background: var(--bg-secondary);
}

[data-theme="dark"] .pricing-card-featured {
    /* Badge-only styling, no border */
}

[data-theme="dark"] .pricing-card:hover {
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

[data-theme="dark"] .comparison-table th {
    background: var(--bg-secondary);
}

[data-theme="dark"] .comparison-table td:nth-child(3) {
    background: rgba(102, 126, 234, 0.06);
}

[data-theme="dark"] .comparison-table .highlight-col {
    background: rgba(102, 126, 234, 0.12);
}

/* ============================================
   RTL Support for Comparison Tables
   ============================================ */
[dir="rtl"] .comparison-table .feature-col,
[dir="rtl"] .comparison-table td:first-child {
    text-align: right;
}

[dir="rtl"] .faq-question {
    text-align: right;
}

[dir="rtl"] .plan-features li {
    flex-direction: row-reverse;
    text-align: right;
}

[dir="rtl"] .pricing-cross-link {
    direction: rtl;
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media (max-width: 600px) {
    .pricing-hero {
        padding: 3rem 1rem 1.5rem;
    }

    .billing-toggle {
        flex-wrap: wrap;
        justify-content: center;
    }

    .product-tabs {
        flex-direction: column;
        align-items: stretch;
        max-width: 300px;
        margin: 0 auto 2rem;
    }

    .pricing-card-featured {
        transform: none;
    }

    .pricing-card-featured:hover {
        transform: translateY(-4px);
    }

    .comparison-table {
        font-size: 0.8rem;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 10px;
    }

    .cta-card {
        padding: 2rem 1.5rem;
    }
}
