:root {
    --bg-dark: #020409;
    --card-bg: rgba(5, 10, 25, 0.65);
    --card-border: rgba(77, 202, 255, 0.35);
    --accent-primary: #35d0ff;
    --accent-secondary: #8f7bff;
    --text-main: #f5f7ff;
    --text-dim: #9ba6c9;
    --glow-heavy: rgba(53, 208, 255, 0.45);
    --glow-light: rgba(143, 123, 255, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    font-family: "Space Grotesk", "Roboto", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

#cosmic-background {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: radial-gradient(circle at 20% 20%, rgba(77, 202, 255, 0.2), transparent 45%),
                radial-gradient(circle at 80% 10%, rgba(143, 123, 255, 0.25), transparent 50%),
                #010206;
}

#starfield-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

#nebula-overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(circle at 60% 60%, rgba(80, 30, 150, 0.35), transparent 60%);
    mix-blend-mode: screen;
    pointer-events: none;
}

.subscription-shell {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding: 4rem clamp(1.5rem, 5vw, 6rem);
    max-width: 1200px;
    margin: 0 auto;
}

.subscription-hero {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.hero-text {
    max-width: 640px;
}

.eyebrow {
    letter-spacing: 0.25em;
    font-family: "Orbitron", "Space Grotesk", sans-serif;
    font-size: 0.9rem;
    color: var(--accent-primary);
    text-decoration: none;
}

.subscription-hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.6rem);
    font-family: "Orbitron", "Space Grotesk", sans-serif;
    margin-bottom: 0.5rem;
}

.hero-subtitle {
    color: var(--text-dim);
    line-height: 1.7;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.billing-status-panel {
    margin-top: 2rem;
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(4, 8, 18, 0.55);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
}

.status-header h3 {
    font-size: 1.8rem;
}

.status-eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.2em;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.status-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-metric {
    flex: 1 1 160px;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.metric-label {
    display: block;
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 600;
}

.status-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
}

.status-note {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.meta-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.75rem;
}

.plan-card {
    position: relative;
    padding: 2rem;
    border-radius: 24px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    overflow: hidden;
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    transform-style: preserve-3d;
    animation: orbitalFloat 12s ease-in-out infinite;
}

.plan-card.is-pointer {
    animation: none;
    transition: transform 0.2s ease;
}

.plan-card::after {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 22px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    pointer-events: none;
}

.plan-glow {
    position: absolute;
    inset: -30%;
    background: radial-gradient(circle, var(--glow-heavy), transparent 60%);
    opacity: 0;
    transition: opacity 0.5s ease;
    filter: blur(25px);
}

.plan-card:hover .plan-glow,
.plan-card:focus-within .plan-glow {
    opacity: 1;
}

.plan-card .plan-header {
    margin-bottom: 1.5rem;
}

.tier-label {
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.plan-card h2 {
    font-size: 1.8rem;
    margin: 0.4rem 0;
}

.tier-tagline {
    color: var(--accent-secondary);
    font-size: 0.95rem;
}

.plan-body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.5rem;
}

.plan-price {
    font-size: 2.25rem;
    font-weight: 600;
}

.plan-description {
    margin-top: 0.75rem;
    color: var(--text-dim);
    line-height: 1.6;
}

.plan-preview .plan-price {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: baseline;
}

.plan-price .price-original {
    font-size: 1.2rem;
    text-decoration: line-through;
    color: var(--text-dim);
    opacity: 0.8;
}

.plan-price .price-current {
    font-size: 2.6rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.plan-credits {
    color: var(--accent-primary);
    font-size: 1rem;
}

.plan-note {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.plan-note.limited {
    color: #ffd8a6;
    letter-spacing: 0.02em;
}

.plan-cta {
    border: none;
    border-radius: 999px;
    padding: 0.85rem 1.75rem;
    background: linear-gradient(120deg, var(--accent-primary), var(--accent-secondary));
    color: var(--text-main);
    font-size: 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.plan-cta:disabled,
.plan-cta[aria-disabled="true"] {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
}

.plan-card:hover .plan-cta {
    transform: translateY(-2px) scale(1.01);
    box-shadow: 0 15px 35px rgba(53, 208, 255, 0.2);
}

.plan-cta.secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: var(--text-main);
    box-shadow: none;
}

.plan-cta.secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.billing-insights {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight {
    padding: 1rem 1.2rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(6, 12, 24, 0.65);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.insight.secondary {
    border-color: rgba(53, 208, 255, 0.25);
    color: var(--accent-primary);
}

.insight.success {
    border-color: rgba(53, 208, 255, 0.45);
    color: #8fffe2;
}

.insight.error {
    border-color: rgba(255, 99, 132, 0.45);
    color: #ff9fb0;
}

.insight.warn {
    border-color: rgba(255, 196, 87, 0.45);
    color: #ffd796;
}

.insight.info {
    border-color: rgba(143, 123, 255, 0.4);
    color: #c6c1ff;
}

.insight-dismiss {
    background: transparent;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
}

.plan-card.featured {
    border-color: rgba(255, 255, 255, 0.35);
    animation-duration: 14s;
}

.plan-card.featured::after {
    border-color: rgba(255, 255, 255, 0.25);
}

.plan-card.plan-preview .plan-price {
    color: #9df0ff;
}

.plan-card.plan-preview .plan-glow {
    opacity: 0.45;
}

.plan-overlay {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: rgba(2, 4, 12, 0.7);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    z-index: 3;
    pointer-events: none;
    color: var(--text-main);
    font-size: 1.1rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    overflow: hidden;
}

.plan-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.12) 40%, transparent 80%);
    animation: overlayShimmer 4s ease-in-out infinite;
}

.plan-overlay p {
    position: relative;
    z-index: 2;
    font-weight: 600;
}

.footnotes {
    color: var(--text-dim);
    font-size: 0.95rem;
    line-height: 1.6;
    border-left: 2px solid rgba(255, 255, 255, 0.1);
    padding-left: 1rem;
}

@keyframes orbitalFloat {
    0% {
        transform: translate3d(0, -6px, 0) rotateX(0deg);
    }
    25% {
        transform: translate3d(0, 0, 10px) rotateX(2deg);
    }
    50% {
        transform: translate3d(0, 6px, -10px) rotateX(-1deg);
    }
    75% {
        transform: translate3d(0, -2px, 8px) rotateX(1deg);
    }
    100% {
        transform: translate3d(0, -6px, 0) rotateX(0deg);
    }
}

@keyframes overlayShimmer {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* ============================================
   CURRENT PLAN INDICATOR
   ============================================ */
.plan-card.is-current-plan {
    border-color: rgba(53, 208, 255, 0.6);
    box-shadow: 0 0 30px rgba(53, 208, 255, 0.25), inset 0 0 20px rgba(53, 208, 255, 0.05);
}

.plan-card.is-current-plan::before {
    content: "";
    position: absolute;
    inset: -2px;
    border-radius: 26px;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary), var(--accent-primary));
    background-size: 300% 300%;
    z-index: -1;
    animation: currentPlanBorderGlow 4s ease infinite;
}

.current-plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(53, 208, 255, 0.2), rgba(143, 123, 255, 0.15));
    border: 1px solid rgba(53, 208, 255, 0.4);
    color: var(--accent-primary);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    animation: badgePulse 2.5s ease-in-out infinite;
}

.current-plan-badge i {
    color: #8fffe2;
}

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

@keyframes badgePulse {
    0%, 100% {
        box-shadow: 0 0 8px rgba(53, 208, 255, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(53, 208, 255, 0.5);
    }
}

/* ============================================
   LOCKED LOWER-TIER PLAN
   ============================================ */
.plan-card.is-locked-plan {
    pointer-events: none;
    filter: grayscale(0.6) brightness(0.7);
    transform: scale(0.97);
    animation: none;
}

.locked-plan-overlay {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background: rgba(2, 4, 12, 0.85);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    overflow: hidden;
}

.locked-plan-overlay::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(
        from 0deg,
        transparent,
        rgba(53, 208, 255, 0.15),
        transparent,
        rgba(143, 123, 255, 0.1),
        transparent
    );
    animation: lockedSweep 6s linear infinite;
}

.locked-plan-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(
        135deg,
        transparent 30%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 70%
    );
    animation: lockedShimmer 3s ease-in-out infinite;
}

.locked-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--text-dim);
}

.locked-content i {
    font-size: 2.5rem;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 0.75rem;
    display: block;
    animation: lockBounce 2s ease-in-out infinite;
}

.locked-content p {
    font-size: 0.95rem;
    letter-spacing: 0.03em;
    max-width: 180px;
}

@keyframes lockedSweep {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes lockedShimmer {
    0%, 100% {
        opacity: 0.3;
        transform: translateX(-30%);
    }
    50% {
        opacity: 0.7;
        transform: translateX(30%);
    }
}

@keyframes lockBounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@media (max-width: 768px) {
    .subscription-shell {
        padding-top: 6rem;
    }

    .plan-card {
        animation-duration: 10s;
    }
}
