/* ================================================
   UPGRADE MODAL - PREMIUM CONVERSION DESIGN
   Beautiful, compelling modals that convert
   ================================================ */

:root {
    --modal-bg: #0D0A09;
    --modal-card-bg: linear-gradient(165deg, #1A1614 0%, #0F0C0A 100%);
    --modal-border: rgba(212, 165, 116, 0.15);
    --modal-glow: rgba(212, 165, 116, 0.08);
    --text-primary: #F5F0EB;
    --text-secondary: #8B7E74;
    --text-muted: #5C544D;
    --accent-gold: #D4A574;
    --accent-gold-bright: #E8C69A;
    --accent-green: #4ADE80;
    --gradient-gold: linear-gradient(135deg, #D4A574 0%, #B8956A 100%);
    --gradient-gold-bright: linear-gradient(135deg, #E8C69A 0%, #D4A574 100%);
    --gradient-success: linear-gradient(135deg, #4ADE80 0%, #22C55E 100%);
}

/* Overlay */
.upgrade-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    animation: modalFadeIn 0.4s ease forwards;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@keyframes modalFadeIn {
    to {
        opacity: 1;
    }
}

/* Modal Container */
.upgrade-modal {
    background: var(--modal-card-bg);
    border-radius: 24px;
    max-width: 480px;
    width: 100%;
    border: 1px solid var(--modal-border);
    box-shadow:
        0 0 0 1px rgba(0, 0, 0, 0.5),
        0 25px 80px -20px rgba(0, 0, 0, 0.8),
        0 0 100px -20px var(--modal-glow);
    position: relative;
    overflow: visible;
    transform: scale(0.95) translateY(20px);
    opacity: 0;
    animation: modalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.1s forwards;
}

@keyframes modalSlideUp {
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

/* Ambient glow effect */
.upgrade-modal::before {
    content: '';
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--modal-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* Close Button */
.upgrade-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    color: var(--text-secondary);
}

.upgrade-modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.05);
}

.upgrade-modal-close svg {
    width: 16px;
    height: 16px;
}

/* Modal Content */
.upgrade-modal-content {
    position: relative;
    z-index: 1;
    padding: 32px 28px 28px;
}

/* Header Badge */
.modal-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(212, 165, 116, 0.12);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 20px;
    padding: 6px 14px;
    margin-bottom: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--accent-gold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.modal-badge .material-symbols-rounded {
    font-size: 14px;
    font-variation-settings: 'FILL' 1;
}

/* Title */
.upgrade-modal-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px;
    line-height: 1.2;
}

/* Subtitle */
.upgrade-modal-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin: 0 0 24px;
    line-height: 1.6;
}

.upgrade-modal-subtitle strong {
    color: var(--accent-gold-bright);
    font-weight: 600;
}

/* Usage Progress Section */
.usage-progress-section {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 24px;
}

.usage-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.usage-progress-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.usage-progress-count {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
}

.usage-progress-count span {
    color: var(--text-secondary);
    font-weight: 500;
}

.usage-progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    overflow: hidden;
}

.usage-progress-fill {
    height: 100%;
    background: var(--gradient-gold);
    border-radius: 10px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.usage-progress-fill.full {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
}

.usage-reset-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.usage-reset-text .material-symbols-rounded {
    font-size: 14px;
}

/* Plan Card */
.upgrade-plan-card {
    background: linear-gradient(165deg, rgba(212, 165, 116, 0.08) 0%, rgba(212, 165, 116, 0.02) 100%);
    border: 1px solid rgba(212, 165, 116, 0.2);
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.upgrade-plan-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 165, 116, 0.4), transparent);
}

.plan-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.plan-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-name span {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--accent-gold);
    margin-top: 2px;
}

.plan-price {
    text-align: right;
}

.plan-price-amount {
    font-family: 'Outfit', sans-serif;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

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

/* Features List */
.upgrade-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.upgrade-feature {
    display: flex;
    align-items: center;
    gap: 12px;
}

.feature-check {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    background: rgba(74, 222, 128, 0.15);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-green);
}

.feature-check .material-symbols-rounded {
    font-size: 14px;
    font-variation-settings: 'FILL' 1, 'wght' 600;
}

.feature-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.feature-text strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* CTA Buttons */
.upgrade-modal-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.btn-upgrade-primary {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #f2cf7b 0%, #d29658 70%, #7d3f26 100%);
    border: none;
    border-radius: 10px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #0a0a0a;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-upgrade-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(242, 207, 123, 0.4),
        0 0 20px rgba(242, 207, 123, 0.3);
}

.btn-upgrade-primary:active {
    transform: translateY(0);
}

.btn-upgrade-primary .material-symbols-rounded {
    font-size: 18px;
    font-variation-settings: 'FILL' 1;
}

.btn-upgrade-secondary {
    width: 100%;
    padding: 14px 24px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-upgrade-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* Footer/Trust badges */
.upgrade-modal-footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.trust-badge .material-symbols-rounded {
    font-size: 14px;
    color: var(--accent-green);
    font-variation-settings: 'FILL' 1;
}

/* ============================================
   FOUNDERS SPECIAL - MODAL STYLING
   ============================================ */

/* Founders Special Card */
.upgrade-plan-card.founders-special {
    border: 2px solid rgba(242, 207, 123, 0.4);
    background: linear-gradient(165deg, rgba(242, 207, 123, 0.12) 0%, rgba(212, 165, 116, 0.04) 100%);
    padding-top: 16px;
    overflow: visible;
    position: relative;
}

/* Discount Badge - positioned top left to avoid price overlap */
.modal-discount-badge {
    position: absolute;
    top: -18px;
    left: -10px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 50%, #b91c1c 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5);
    animation: discountPulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes discountPulse {

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

    50% {
        transform: scale(1.05);
    }
}

.modal-discount-badge .discount-percent {
    font-size: 17px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
}

.modal-discount-badge .discount-off {
    font-size: 9px;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    margin-top: 1px;
}

/* Founders Ribbon Inline */
.founders-ribbon-inline {
    display: inline-block;
    padding: 4px 10px;
    background: linear-gradient(135deg, #f2cf7b 0%, #d29658 100%);
    color: #0a0a0a;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    border-radius: 12px;
    margin-bottom: 6px;
}

/* Original Price Strikethrough - LARGER */
.original-price-modal {
    font-size: 1.1rem;
    font-weight: 600;
    color: rgba(196, 181, 160, 0.6);
    text-decoration: line-through;
    text-decoration-color: #ef4444;
    text-decoration-thickness: 2px;
    margin-bottom: 4px;
}

/* Founders Price Highlight */
.plan-price-amount.founders-price {
    color: #f2cf7b;
    filter: drop-shadow(0 0 8px rgba(242, 207, 123, 0.4));
}

/* Urgency Message */
.founders-urgency-modal {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    color: #fca5a5;
    font-size: 0.8rem;
    font-weight: 600;
}

.founders-urgency-modal .material-symbols-rounded {
    font-size: 16px;
    color: #f87171;
}

/* ============================================
   MOBILE RESPONSIVE - FOUNDERS SPECIAL
   ============================================ */
@media (max-width: 540px) {
    .upgrade-plan-card.founders-special {
        padding-top: 14px;
        margin-top: 12px;
    }

    .modal-discount-badge {
        width: 48px;
        height: 48px;
        top: -16px;
        left: -8px;
    }

    .modal-discount-badge .discount-percent {
        font-size: 14px;
    }

    .modal-discount-badge .discount-off {
        font-size: 7px;
    }

    .founders-ribbon-inline {
        font-size: 8px;
        padding: 3px 8px;
    }

    .original-price-modal {
        font-size: 0.95rem;
    }

    .founders-urgency-modal {
        font-size: 0.7rem;
        padding: 8px 10px;
        gap: 6px;
    }

    .founders-urgency-modal .material-symbols-rounded {
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .modal-discount-badge {
        width: 42px;
        height: 42px;
        top: -14px;
        left: -6px;
    }

    .modal-discount-badge .discount-percent {
        font-size: 12px;
    }

    .modal-discount-badge .discount-off {
        font-size: 6px;
    }

    .original-price-modal {
        font-size: 0.85rem;
    }

    .founders-urgency-modal {
        font-size: 0.65rem;
        padding: 6px 8px;
    }
}

/* ============================================
   MOBILE RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 540px) {
    .upgrade-modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .upgrade-modal {
        max-width: 100%;
        width: 100%;
        border-radius: 24px 24px 0 0;
        max-height: 95vh;
        max-height: 95dvh;
        overflow-y: auto;
        animation: modalSlideUpMobile 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    @keyframes modalSlideUpMobile {
        from {
            transform: translateY(100%);
            opacity: 1;
        }

        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .upgrade-modal::before {
        display: none;
    }

    .upgrade-modal-content {
        padding: 24px 20px 32px;
        padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px));
    }

    .upgrade-modal-close {
        top: 12px;
        right: 12px;
    }

    .modal-badge {
        padding: 5px 12px;
        font-size: 0.7rem;
        margin-bottom: 16px;
    }

    .upgrade-modal-title {
        font-size: 1.5rem;
    }

    .upgrade-modal-subtitle {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    .usage-progress-section {
        padding: 16px;
        margin-bottom: 20px;
    }

    .upgrade-plan-card {
        padding: 20px;
        margin-bottom: 16px;
    }

    .plan-name {
        font-size: 1.1rem;
    }

    .plan-price-amount {
        font-size: 1.75rem;
    }

    .upgrade-features {
        gap: 10px;
    }

    .feature-check {
        width: 20px;
        height: 20px;
    }

    .feature-check .material-symbols-rounded {
        font-size: 12px;
    }

    .feature-text {
        font-size: 0.85rem;
    }

    .btn-upgrade-primary {
        padding: 15px 20px;
        font-size: 0.95rem;
    }

    .btn-upgrade-secondary {
        padding: 12px 20px;
        font-size: 0.85rem;
    }

    .upgrade-modal-footer {
        flex-wrap: wrap;
        gap: 12px;
        justify-content: center;
    }

    .trust-badge {
        font-size: 0.7rem;
    }
}

/* Extra small */
@media (max-width: 380px) {
    .upgrade-modal-content {
        padding: 20px 16px 28px;
    }

    .upgrade-modal-title {
        font-size: 1.35rem;
    }

    .plan-header {
        flex-direction: column;
        gap: 12px;
    }

    .plan-price {
        text-align: left;
    }
}

/* Legacy support for old modal structure */
.upgrade-btn-primary {
    width: 100%;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #f2cf7b 0%, #d29658 70%, #7d3f26 100%);
    border: none;
    border-radius: 10px;
    font-family: 'Quicksand', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #0a0a0a;
    cursor: pointer;
}

.upgrade-btn-secondary {
    width: 100%;
    padding: 14px 24px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ============================================
   MODAL BILLING TOGGLE
   ============================================ */

.modal-billing-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    position: relative;
    background: rgba(15, 12, 10, 0.9);
    border: 1px solid rgba(242, 207, 123, 0.15);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 20px;
    width: 100%;
    box-shadow:
        inset 0 1px 3px rgba(0, 0, 0, 0.4),
        0 4px 16px rgba(0, 0, 0, 0.25);
}

.modal-toggle-option {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: rgba(196, 181, 160, 0.5);
    font-family: 'Quicksand', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.modal-toggle-option:hover:not(.active) {
    color: rgba(242, 207, 123, 0.7);
}

.modal-toggle-option.active {
    color: #0f0d0a;
    font-weight: 700;
}

.modal-toggle-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 20px;
    color: #ffffff !important;
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.35);
    line-height: 1;
}

.modal-toggle-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #f2cf7b 0%, #e0b565 50%, #c9a050 100%);
    border-radius: 10px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow:
        0 2px 8px rgba(242, 207, 123, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    z-index: 1;
}

/* Move slider to right for yearly */
.modal-billing-toggle[data-active="yearly"] .modal-toggle-slider {
    transform: translateX(100%);
}

/* Inline Savings Badge (New Layout) */
.inline-save-badge {
    display: inline-block;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff !important;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 8px;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Adjust plan header to accommodate badge */
.modal-plan-yearly .plan-header {
    margin-bottom: 24px;
    /* Ensure space for content */
}

/* Monthly Equivalent Price */
.plan-monthly-equiv {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
    margin-top: 4px;
}

/* Yearly Plan Card styling */
.modal-plan-yearly {
    position: relative;
    border: 2px solid rgba(34, 197, 94, 0.3);
    background: linear-gradient(165deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.02) 100%);
}

.modal-savings-badge .discount-percent {
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    letter-spacing: 0.5px;
}

.modal-savings-badge .discount-off {
    font-size: 16px;
    font-weight: 900;
    color: #fff;
    line-height: 1;
    margin-top: 1px;
}

/* Monthly Equivalent Price */
.plan-monthly-equiv {
    font-size: 0.75rem;
    color: #22c55e;
    font-weight: 600;
    margin-top: 4px;
}

/* Yearly Plan Card styling */
.modal-plan-yearly {
    position: relative;
    border: 2px solid rgba(34, 197, 94, 0.3);
    background: linear-gradient(165deg, rgba(34, 197, 94, 0.08) 0%, rgba(34, 197, 94, 0.02) 100%);
}

/* Monthly Plan Card styling */
.modal-plan-monthly {
    border: 1px solid rgba(212, 165, 116, 0.2);
}

/* Mobile responsive for modal toggle */
@media (max-width: 540px) {
    .modal-billing-toggle {
        margin-bottom: 16px;
    }

    .modal-toggle-option {
        padding: 10px 12px;
        font-size: 13px;
        gap: 6px;
    }

    .modal-toggle-badge {
        font-size: 8px;
        padding: 2px 6px;
    }

    .modal-savings-badge {
        width: 46px;
        height: 46px;
        top: -10px;
        right: 12px;
    }

    .modal-savings-badge .discount-percent {
        font-size: 9px;
    }

    .modal-savings-badge .discount-off {
        font-size: 14px;
    }
}

@media (max-width: 380px) {
    .modal-toggle-option {
        padding: 8px 10px;
        font-size: 12px;
        flex-direction: column;
        gap: 4px;
    }

    .modal-toggle-badge {
        font-size: 7px;
    }

    .modal-savings-badge {
        width: 40px;
        height: 40px;
        top: -8px;
        right: 10px;
    }

    .modal-savings-badge .discount-percent {
        font-size: 8px;
    }

    .modal-savings-badge .discount-off {
        font-size: 12px;
    }
}