/**
 * Subscriptions Page — matching Uploads design language
 */

/* ── Animations ──────────────────────────── */
@keyframes cardFadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmerGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(var(--bs-primary-rgb), 0.15); }
    50% { box-shadow: 0 0 0 6px rgba(var(--bs-primary-rgb), 0); }
}

@keyframes checkIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes featureSlideIn {
    from {
        opacity: 0;
        transform: translateX(-8px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ── Hero gradient title ───────────────────── */
.subscriptions-hero-title {
    margin: 0 !important;
    line-height: 1.05;
    padding: 0.15rem 0;
    font-weight: 700 !important;
    font-size: clamp(2.25rem, 2vw + 1rem, 2.75rem);
    letter-spacing: -0.01em;
    background: linear-gradient(90deg, #0ea5e9, #6366f1, #a855f7);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: shimmerGradient 6s ease infinite;
}

.subscriptions-card .card-header .badge {
    font-weight: 600;
    letter-spacing: 0.03em;
    animation: checkIn 0.4s ease both;
}

/* ── Entrance stagger for page sections ──── */
.subscriptions-card .card-body > * {
    animation: cardFadeUp 0.45s ease both;
}

.subscriptions-card .card-body > *:nth-child(1) { animation-delay: 0.04s; }
.subscriptions-card .card-body > *:nth-child(2) { animation-delay: 0.08s; }
.subscriptions-card .card-body > *:nth-child(3) { animation-delay: 0.12s; }
.subscriptions-card .card-body > *:nth-child(4) { animation-delay: 0.16s; }
.subscriptions-card .card-body > *:nth-child(5) { animation-delay: 0.20s; }
.subscriptions-card .card-body > *:nth-child(6) { animation-delay: 0.24s; }

/* ── Current plan card ─────────────────────── */
.current-plan-card {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.current-plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #0ea5e9, #6366f1, #a855f7);
    background-size: 200% 200%;
    border-radius: var(--bs-border-radius-lg) var(--bs-border-radius-lg) 0 0;
    animation: shimmerGradient 4s ease infinite;
}

.current-plan-card:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.35);
    box-shadow: 0 0.75rem 1.5rem rgba(var(--bs-primary-rgb), 0.1);
}

.current-plan-card .plan-price {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.current-plan-card .badge {
    animation: pulseGlow 2.5s ease infinite;
}

.dark-style .current-plan-card {
    border-color: rgba(255, 255, 255, 0.12);
    background: linear-gradient(135deg, #2b3045 0%, #2d3045 45%, #2b3045 100%);
}

.dark-style .current-plan-card:hover {
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: none;
}

/* ── Empty state ───────────────────────────── */
.empty-plan-card {
    border: 1px dashed var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    padding: 3rem 1.5rem;
    text-align: center;
    transition: border-color 0.3s ease;
}

.empty-plan-card:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.35);
}

.empty-plan-card .avatar {
    transition: transform 0.3s ease;
}

.empty-plan-card:hover .avatar {
    transform: scale(1.08);
}

.dark-style .empty-plan-card {
    border-color: rgba(255, 255, 255, 0.12);
}

/* ── Promo code card ────────────────────────── */
.promo-code-card {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    padding: 1.25rem 1.5rem;
    background: var(--bs-card-bg);
    transition: border-color 0.3s ease;
}

.promo-code-card:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.35);
}

.promo-code-card .input-group {
    max-width: 480px;
}

.dark-style .promo-code-card {
    border-color: rgba(255, 255, 255, 0.12);
}

/* ── Plan selection section ────────────────── */
.plan-section-header {
    margin-bottom: 1.25rem;
}

.plan-section-divider {
    border-top: 1px dashed var(--bs-border-color);
    margin: 2rem 0;
}

/* ── Plan cards ────────────────────────────── */
.plan-card {
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius-lg);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    position: relative;
    animation: cardFadeUp 0.5s ease both;
}

/* Stagger plan card entrance */
.row > .col:nth-child(1) > .plan-card { animation-delay: 0.06s; }
.row > .col:nth-child(2) > .plan-card { animation-delay: 0.14s; }
.row > .col:nth-child(3) > .plan-card { animation-delay: 0.22s; }
.row > .col:nth-child(4) > .plan-card { animation-delay: 0.30s; }

.plan-card:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    box-shadow: 0 0.75rem 1.5rem rgba(var(--bs-primary-rgb), 0.15);
    transform: translateY(-4px);
}

.plan-card[data-is-current="true"] {
    border-color: rgba(var(--bs-primary-rgb), 0.6);
    box-shadow: 0 0 0 1px rgba(var(--bs-primary-rgb), 0.12);
}

.plan-card[data-is-current="true"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #6366f1, #a855f7);
    background-size: 200% 200%;
    animation: shimmerGradient 4s ease infinite;
}

.plan-card[data-is-current="true"] .badge {
    animation: checkIn 0.35s ease both 0.3s;
}

.dark-style .plan-card {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.dark-style .plan-card:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.4);
    box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.25);
    transform: translateY(-4px);
}

.dark-style .plan-card[data-is-current="true"] {
    border-color: rgba(var(--bs-primary-rgb), 0.5);
    box-shadow: none;
}

/* ── Plan pricing ──────────────────────────── */
.plan-price-block {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.plan-price-block .price-amount {
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.25px;
    line-height: 1;
    transition: color 0.2s ease;
}

.plan-card:hover .plan-price-block .price-amount {
    color: var(--bs-primary);
}

.plan-price-block .price-interval {
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
}

.plan-savings {
    font-size: 0.75rem;
    color: var(--bs-success);
    font-weight: 600;
    display: inline-block;
    padding: 0.125rem 0.5rem;
    background: rgba(var(--bs-success-rgb), 0.08);
    border-radius: var(--bs-border-radius);
}

/* ── Plan features list ────────────────────── */
.plan-features {
    list-style: none;
    padding: 0;
    margin: 0;
}

.plan-features li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    border-bottom: 1px dashed rgba(var(--bs-body-color-rgb), 0.08);
    animation: featureSlideIn 0.35s ease both;
}

.plan-features li:nth-child(1) { animation-delay: 0.05s; }
.plan-features li:nth-child(2) { animation-delay: 0.08s; }
.plan-features li:nth-child(3) { animation-delay: 0.11s; }
.plan-features li:nth-child(4) { animation-delay: 0.14s; }
.plan-features li:nth-child(5) { animation-delay: 0.17s; }
.plan-features li:nth-child(6) { animation-delay: 0.20s; }
.plan-features li:nth-child(7) { animation-delay: 0.23s; }

.plan-features li:last-child {
    border-bottom: none;
}

.plan-features .feature-label {
    color: var(--bs-secondary-color);
    transition: color 0.2s ease;
}

.plan-card:hover .plan-features .feature-label {
    color: var(--bs-body-color);
}

.plan-features .feature-value {
    font-weight: 600;
    text-align: end;
}

.dark-style .plan-features li {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* ── Billing toggle ────────────────────────── */
.billing-toggle {
    display: flex;
    border-radius: var(--bs-border-radius-lg);
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    background: rgba(var(--bs-body-color-rgb), 0.02);
}

.billing-toggle .btn-check + .btn {
    border: none;
    border-radius: 0;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    color: var(--bs-secondary-color);
    flex: 1;
    position: relative;
}

.billing-toggle .btn-check:checked + .btn {
    background: var(--bs-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(var(--bs-primary-rgb), 0.3);
}

.dark-style .billing-toggle {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

.dark-style .billing-toggle .btn-check + .btn {
    color: rgba(255, 255, 255, 0.6);
}

.dark-style .billing-toggle .btn-check:checked + .btn {
    background: var(--bs-primary);
    color: #fff;
}

/* ── Subscribe / action button ─────────────── */
.plan-card .subscribe-button {
    border-radius: var(--bs-border-radius-lg);
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.plan-card .subscribe-button::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.plan-card .subscribe-button:not(:disabled):hover::after {
    transform: translateX(100%);
}

.plan-card .subscribe-button:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(var(--bs-primary-rgb), 0.35);
}

/* ── Reduced motion ──────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .subscriptions-hero-title,
    .current-plan-card::before,
    .plan-card[data-is-current="true"]::before {
        animation: none;
    }

    .subscriptions-card .card-body > *,
    .plan-card,
    .plan-features li,
    .subscriptions-card .card-header .badge,
    .plan-card[data-is-current="true"] .badge {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .plan-card .subscribe-button::after {
        display: none;
    }
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 767.98px) {
    .subscriptions-hero-title {
        font-size: clamp(1.5rem, 4vw, 2rem);
    }

    .current-plan-card {
        padding: 1rem;
    }

    .current-plan-card .plan-price {
        font-size: 1.5rem;
    }
}

/* ── RTL support ─────────────────────────── */
[dir="rtl"] .plan-features li {
    animation-name: none;
}
