/* ==========================================================================
   billing.css
   Styles for all billing pages: pricing cards, upgrade page,
   checkout success/cancel, enterprise contact form.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Design tokens (mirrors home.css palette)
   -------------------------------------------------------------------------- */
:root {
    --billing-navy-deep:   #071828;
    --billing-navy:        #0a2540;
    --billing-navy-mid:    #0f3d5c;
    --billing-blue:        #1a5a8e;
    --billing-blue-mid:    #2d7aaf;
    --billing-blue-light:  #408fc4;
    --billing-sky:         #5ba3d0;
    --billing-card-bg:     rgba(255, 255, 255, 0.96);
    --billing-card-border: rgba(168, 212, 237, 0.4);
    --billing-radius:      14px;
    --billing-shadow:      0 8px 32px rgba(7, 24, 40, 0.14);
    --billing-highlight:   #2d7aaf;
}

/* ==========================================================================
   Pricing section (embedded in homepage or standalone page)
   ========================================================================== */

.pricing-section {
    padding: 80px 0 96px;
    background: linear-gradient(180deg, #ffffff 0%, #e0f0fa 100%);
    position: relative;
    overflow: hidden;
}

/* Subtle radial glow matching home.css hero patterns */
.pricing-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 20% 60%, rgba(64, 143, 196, 0.08) 0%, transparent 70%),
        radial-gradient(ellipse 50% 35% at 80% 30%, rgba(45, 122, 175, 0.06) 0%, transparent 70%);
    pointer-events: none;
}

.pricing-section .section-header {
    text-align: center;
    margin-bottom: 48px;
}

.pricing-section .section-title {
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    font-weight: 700;
    background: linear-gradient(135deg, #0a2540 0%, #2d7aaf 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
    position: relative;
    display: inline-block;
}

.pricing-section .section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 64px;
    height: 3px;
    background: linear-gradient(90deg, #2d7aaf, #408fc4);
    border-radius: 2px;
}

.pricing-section .section-subtitle {
    color: #4a6b8a;
    font-size: 1.05rem;
    margin-top: 16px;
}

/* --------------------------------------------------------------------------
   Founding-member banner
   -------------------------------------------------------------------------- */

.founding-banner {
    background: linear-gradient(135deg, #0f3d5c 0%, #1a5a8e 100%);
    border: 1px solid rgba(91, 163, 208, 0.35);
    border-radius: var(--billing-radius);
    padding: 14px 24px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #e0f0fa;
    font-size: 0.92rem;
    text-align: center;
}

.founding-banner__icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.founding-banner strong {
    color: #fff;
}

#founding-slots-remaining.founding-slots--critical {
    border-color: rgba(231, 76, 60, 0.6);
    animation: founding-pulse 1.4s ease-in-out infinite;
}

@keyframes founding-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.15); }
}

/* --------------------------------------------------------------------------
   Trial callout strip
   -------------------------------------------------------------------------- */

.billing-trial-callout {
    text-align: center;
    font-size: 0.9rem;
    color: #4a6b8a;
    margin-bottom: 32px;
}

.billing-trial-callout strong {
    color: var(--billing-blue);
}

/* --------------------------------------------------------------------------
   Tier grid
   -------------------------------------------------------------------------- */

.tier-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 24px;
    max-width: 1100px;
    margin: 0 auto;
}

/* --------------------------------------------------------------------------
   Tier card (matches .feature-card from home.css)
   -------------------------------------------------------------------------- */

.tier-card {
    background: var(--billing-card-bg);
    border: 1px solid var(--billing-card-border);
    border-radius: var(--billing-radius);
    padding: 32px 24px 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--billing-shadow);
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    animation: fadeInUp 0.5s ease both;
}

.tier-card:nth-child(1) { animation-delay: 0.05s; }
.tier-card:nth-child(2) { animation-delay: 0.12s; }
.tier-card:nth-child(3) { animation-delay: 0.19s; }
.tier-card:nth-child(4) { animation-delay: 0.26s; }

.tier-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 48px rgba(7, 24, 40, 0.18);
}

/* Top accent line (matches .feature-card::after) */
.tier-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--billing-blue-mid), var(--billing-sky));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.tier-card:hover::after {
    transform: scaleX(1);
}

/* Highlighted / "Most Popular" card */
.tier-card--highlighted {
    border-color: rgba(45, 122, 175, 0.6);
    box-shadow: 0 8px 40px rgba(45, 122, 175, 0.22);
}

.tier-card--highlighted::after {
    transform: scaleX(1);
    background: linear-gradient(90deg, #1a5a8e, #5ba3d0);
}

/* Current plan state */
.tier-card--current {
    border-color: rgba(45, 122, 175, 0.7);
    background: rgba(224, 240, 250, 0.7);
}

/* Card header */
.tier-card__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.tier-card__name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--billing-navy);
    margin: 0;
}

.tier-card__badge {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.tier-card__badge--popular {
    background: rgba(26, 90, 142, 0.12);
    color: var(--billing-blue);
    border: 1px solid rgba(26, 90, 142, 0.25);
}

.tier-card__badge--current {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.tier-card__desc {
    font-size: 0.85rem;
    color: #5a7a96;
    margin: 0;
}

/* Price block */
.tier-card__price {
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.tier-card__amount {
    font-size: 2rem;
    font-weight: 800;
    color: var(--billing-navy);
    line-height: 1;
}

.tier-card__amount--contact {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--billing-blue);
}

.tier-card__period {
    font-size: 0.85rem;
    color: #7a9bb5;
}

/* Feature list */
.tier-card__features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.tier-card__features li {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #3a5a74;
}

.tier-card__features li::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    min-width: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%232d7aaf' opacity='0.15'/%3E%3Cpath d='M4.5 8.5l2.5 2.5 4.5-5' stroke='%232d7aaf' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
}

/* CTA button */
.tier-card__cta {
    display: block;
    width: 100%;
    padding: 10px 0;
    background: linear-gradient(135deg, var(--billing-blue) 0%, var(--billing-sky) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    transition: opacity 0.18s, transform 0.18s;
    margin-top: auto;
}

.tier-card__cta:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.tier-card__cta--disabled {
    background: #c8d8e4;
    color: #6a8aa0;
    cursor: default;
    transform: none;
    opacity: 1;
}

.tier-card__cta--enterprise {
    background: transparent;
    border: 2px solid var(--billing-blue-mid);
    color: var(--billing-blue);
}

.tier-card__cta--enterprise:hover {
    background: var(--billing-blue-mid);
    color: #fff;
    opacity: 1;
}

/* Firm limit label */
.tier-card__firm-limit {
    font-size: 0.78rem;
    color: #7a9bb5;
    text-align: center;
}

/* ==========================================================================
   Upgrade page (dark navy glassmorphism)
   ========================================================================== */

.upgrade-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0a2540 0%, #408fc4 100%);
    padding: 60px 16px 80px;
    position: relative;
    overflow: hidden;
}

/* Animated background orbs */
.upgrade-page::before,
.upgrade-page::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.upgrade-page::before {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(64, 143, 196, 0.18) 0%, transparent 70%);
    top: -200px;
    right: -100px;
    animation: orb-drift 12s ease-in-out infinite alternate;
}

.upgrade-page::after {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(91, 163, 208, 0.12) 0%, transparent 70%);
    bottom: -100px;
    left: -80px;
    animation: orb-drift 16s ease-in-out infinite alternate-reverse;
}

@keyframes orb-drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(30px, 20px) scale(1.05); }
}

.upgrade-card {
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: 40px 36px;
    max-width: 560px;
    margin: 0 auto 48px;
    color: #e0f0fa;
    position: relative;
    z-index: 1;
}

.upgrade-card__title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 8px;
}

.upgrade-card__reason {
    font-size: 1rem;
    color: rgba(224, 240, 250, 0.8);
    margin-bottom: 0;
}

.upgrade-tiers {
    max-width: 920px;
    margin: 0 auto 32px;
    position: relative;
    z-index: 1;
}

/* Dark tier cards for upgrade page */
.upgrade-tiers .tier-card {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e0f0fa;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

.upgrade-tiers .tier-card:hover {
    background: rgba(255, 255, 255, 0.11);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.upgrade-tiers .tier-card__name {
    color: #fff;
}

.upgrade-tiers .tier-card__amount {
    color: #fff;
}

.upgrade-tiers .tier-card__desc,
.upgrade-tiers .tier-card__period,
.upgrade-tiers .tier-card__firm-limit {
    color: rgba(224, 240, 250, 0.65);
}

.upgrade-tiers .tier-card__features li {
    color: rgba(224, 240, 250, 0.85);
}

.upgrade-tiers .tier-card__features li::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='8' cy='8' r='8' fill='%235ba3d0' opacity='0.25'/%3E%3Cpath d='M4.5 8.5l2.5 2.5 4.5-5' stroke='%235ba3d0' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.upgrade-tiers .tier-card__cta {
    background: linear-gradient(135deg, #2d7aaf 0%, #5ba3d0 100%);
}

.upgrade-tiers .tier-card__cta--enterprise {
    background: transparent;
    border-color: rgba(91, 163, 208, 0.5);
    color: #5ba3d0;
}

.upgrade-tiers .tier-card__cta--enterprise:hover {
    background: rgba(91, 163, 208, 0.15);
    color: #e0f0fa;
}

/* Read-only continue link */
.upgrade-readonly-link {
    text-align: center;
    position: relative;
    z-index: 1;
}

.upgrade-readonly-link a,
.upgrade-readonly-link button {
    background: none;
    border: none;
    color: rgba(224, 240, 250, 0.6);
    font-size: 0.875rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.upgrade-readonly-link a:hover,
.upgrade-readonly-link button:hover {
    color: rgba(224, 240, 250, 0.9);
}

/* ==========================================================================
   Checkout success / cancel pages (light workspace theme)
   ========================================================================== */

.checkout-result-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f0f8ff 0%, #e0f0fa 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 16px;
}

.checkout-result-card {
    background: #fff;
    border: 1px solid var(--billing-card-border);
    border-radius: 20px;
    padding: 56px 48px;
    max-width: 480px;
    width: 100%;
    text-align: center;
    box-shadow: var(--billing-shadow);
    animation: fadeInUp 0.5s ease both;
}

.checkout-result-card__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.checkout-result-card__icon--success {
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
}

.checkout-result-card__icon--cancel {
    background: rgba(251, 191, 36, 0.12);
    color: #f59e0b;
}

.checkout-result-card__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--billing-navy);
    margin-bottom: 12px;
}

.checkout-result-card__body {
    color: #4a6b8a;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 32px;
}

.checkout-result-card__actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-billing-primary {
    display: inline-block;
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--billing-blue) 0%, var(--billing-sky) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 10px;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.18s, transform 0.18s;
}

.btn-billing-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

.btn-billing-secondary {
    display: inline-block;
    padding: 10px 28px;
    background: transparent;
    color: var(--billing-blue);
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 10px;
    border: 2px solid rgba(45, 122, 175, 0.35);
    text-decoration: none;
    transition: border-color 0.18s, background 0.18s;
}

.btn-billing-secondary:hover {
    border-color: var(--billing-blue-mid);
    background: rgba(45, 122, 175, 0.05);
    color: var(--billing-blue);
    text-decoration: none;
}

/* ==========================================================================
   Enterprise contact form
   ========================================================================== */

.enterprise-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f0f8ff 0%, #e0f0fa 100%);
    padding: 60px 16px 80px;
}

.enterprise-card {
    background: #fff;
    border: 1px solid var(--billing-card-border);
    border-radius: 20px;
    padding: 48px 44px;
    max-width: 620px;
    margin: 0 auto;
    box-shadow: var(--billing-shadow);
    animation: fadeInUp 0.5s ease both;
}

.enterprise-card__title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--billing-navy);
    margin-bottom: 8px;
}

.enterprise-card__subtitle {
    color: #4a6b8a;
    font-size: 0.95rem;
    margin-bottom: 32px;
}

.enterprise-form .form-group {
    margin-bottom: 20px;
}

.enterprise-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--billing-navy-mid);
    margin-bottom: 6px;
}

.enterprise-form label .required-star {
    color: #e74c3c;
    margin-left: 2px;
}

.enterprise-form input,
.enterprise-form textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid rgba(168, 212, 237, 0.6);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--billing-navy);
    background: #fafcff;
    transition: border-color 0.18s, box-shadow 0.18s;
    outline: none;
    box-sizing: border-box;
}

.enterprise-form input:focus,
.enterprise-form textarea:focus {
    border-color: var(--billing-blue-mid);
    box-shadow: 0 0 0 3px rgba(45, 122, 175, 0.12);
    background: #fff;
}

.enterprise-form textarea {
    resize: vertical;
    min-height: 120px;
}

.enterprise-form .btn-billing-primary {
    width: 100%;
    padding: 13px 0;
    font-size: 1rem;
    margin-top: 8px;
}

/* ==========================================================================
   Shared: hidden checkout form
   ========================================================================== */

#billing-checkout-form {
    display: none;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
    .tier-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
    }

    .upgrade-card {
        padding: 28px 20px;
    }

    .checkout-result-card {
        padding: 36px 24px;
    }

    .enterprise-card {
        padding: 32px 20px;
    }

    .founding-banner {
        flex-direction: column;
        gap: 8px;
    }
}

/* ==========================================================================
   Keyframes (referenced by tier cards)
   ========================================================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
