/* ==========================================================================
   SUBSCRIPTION DIALOG - FULLSCREEN MULTI-STEP
   clearTime Subscription Flow
   ========================================================================== */

:root {
    --ct-sub-red: #EF5350;
    --ct-sub-red-hover: #E53935;
    --ct-sub-dark: #1a1a2e;
    --ct-sub-gray: #6B7280;
    --ct-sub-gray-light: #F3F4F6;
    --ct-sub-border: #E5E7EB;
    --ct-sub-success: #10B981;
    --ct-sub-success-hover: #059669;
    --ct-sub-error: #EF4444;
    --ct-sub-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --ct-sub-radius: 16px;
    --ct-sub-radius-sm: 12px;
    --ct-sub-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.ct-sub-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 30, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s var(--ct-sub-ease);
}

.ct-sub-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Dialog Container
   ========================================================================== */

.ct-sub-dialog {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    font-family: var(--ct-sub-font);
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(20px);
    transition: all 0.4s var(--ct-sub-ease);
}

.ct-sub-dialog.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   Header
   ========================================================================== */

.ct-sub-dialog__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 32px;
    border-bottom: 1px solid var(--ct-sub-border);
    flex-shrink: 0;
    background: #fff;
}

.ct-sub-dialog__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ct-sub-dark);
    margin: 0;
}

.ct-sub-dialog__close {
    width: 44px;
    height: 44px;
    border: none;
    background: var(--ct-sub-gray-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--ct-sub-gray);
    transition: all 0.2s;
}

.ct-sub-dialog__close:hover {
    background: var(--ct-sub-red);
    color: #fff;
    transform: rotate(90deg);
}

/* ==========================================================================
   Progress Indicator
   ========================================================================== */

.ct-sub-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 32px;
    gap: 0;
    flex-shrink: 0;
    background: var(--ct-sub-gray-light);
}

.ct-sub-progress__dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.ct-sub-progress__number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    color: var(--ct-sub-gray);
    border: 2px solid var(--ct-sub-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.3s;
}

.ct-sub-progress__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--ct-sub-gray);
    transition: all 0.3s;
}

.ct-sub-progress__dot.active .ct-sub-progress__number {
    background: var(--ct-sub-red);
    color: #fff;
    border-color: var(--ct-sub-red);
    box-shadow: 0 4px 12px rgba(239, 83, 80, 0.3);
}

.ct-sub-progress__dot.active .ct-sub-progress__label {
    color: var(--ct-sub-red);
}

.ct-sub-progress__dot.completed .ct-sub-progress__number {
    background: var(--ct-sub-success);
    color: #fff;
    border-color: var(--ct-sub-success);
}

.ct-sub-progress__dot.completed .ct-sub-progress__number::before {
    content: '\2713';
    font-size: 16px;
}

.ct-sub-progress__line {
    flex: 0 0 40px;
    height: 2px;
    background: var(--ct-sub-border);
    margin: 0 8px;
    margin-bottom: 28px;
    transition: background 0.3s;
}

.ct-sub-progress__dot.completed + .ct-sub-progress__line {
    background: var(--ct-sub-success);
}

/* ==========================================================================
   Steps Container
   ========================================================================== */

.ct-sub-steps {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.ct-sub-step {
    display: none;
    animation: subStepFadeIn 0.4s var(--ct-sub-ease);
}

.ct-sub-step.active {
    display: block;
}

@keyframes subStepFadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ct-sub-step__title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--ct-sub-dark);
    margin: 0 0 8px;
}

.ct-sub-step__subtitle {
    font-size: 15px;
    color: var(--ct-sub-gray);
    margin: 0 0 24px;
    line-height: 1.6;
}

/* ==========================================================================
   Info Box (Step 1)
   ========================================================================== */

.ct-sub-info-box {
    background: #fff;
    border: 1px solid var(--ct-sub-border);
    border-radius: var(--ct-sub-radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.ct-sub-info-box--secondary {
    background: var(--ct-sub-gray-light);
}

.ct-sub-info-box__icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: var(--ct-sub-red);
}

.ct-sub-info-box__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ct-sub-dark);
    margin: 0 0 12px;
}

.ct-sub-info-box__text {
    font-size: 15px;
    color: var(--ct-sub-gray);
    line-height: 1.6;
    margin: 0;
}

.ct-sub-info-box__list {
    font-size: 15px;
    color: var(--ct-sub-gray);
    line-height: 1.8;
    margin: 0;
    padding-left: 20px;
}

.ct-sub-info-box__list li {
    margin-bottom: 4px;
}

/* ==========================================================================
   Coming Soon Notice
   ========================================================================== */

.ct-sub-coming-soon {
    background: linear-gradient(135deg, #FEE2E2 0%, #FECACA 100%);
    border: 2px solid var(--ct-sub-red);
    border-radius: var(--ct-sub-radius);
    padding: 32px;
    text-align: center;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
}

.ct-sub-coming-soon::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--ct-sub-red) 0%, var(--ct-sub-red-hover) 100%);
}

.ct-sub-coming-soon__icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
    color: var(--ct-sub-red);
}

.ct-sub-coming-soon__icon svg {
    animation: ct-sub-pulse 2s ease-in-out infinite;
}

@keyframes ct-sub-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.ct-sub-coming-soon__title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #991B1B;
    margin: 0 0 12px 0;
}

.ct-sub-coming-soon__text {
    font-size: 1rem;
    color: #7F1D1D;
    line-height: 1.6;
    margin: 0;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 640px) {
    .ct-sub-coming-soon {
        padding: 24px 20px;
    }

    .ct-sub-coming-soon__title {
        font-size: 1.25rem;
    }

    .ct-sub-coming-soon__text {
        font-size: 0.95rem;
    }
}

/* ==========================================================================
   App Download CTA
   ========================================================================== */

.ct-sub-app-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 20px 24px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
    border-radius: var(--ct-sub-radius);
    margin-bottom: 20px;
}

.ct-sub-app-cta__content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ct-sub-app-cta__icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ct-sub-app-cta__icon svg {
    color: #fff;
}

.ct-sub-app-cta__text h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 4px 0;
}

.ct-sub-app-cta__text p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.ct-sub-app-cta__button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #fff;
    color: var(--ct-sub-dark);
    font-family: var(--ct-sub-font);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ct-sub-app-cta__button:hover {
    background: var(--ct-sub-gray-light);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.ct-sub-app-cta__button svg {
    color: #34A853;
}

@media (max-width: 640px) {
    .ct-sub-app-cta {
        flex-direction: column;
        text-align: center;
        padding: 24px 20px;
    }

    .ct-sub-app-cta__content {
        flex-direction: column;
        gap: 12px;
    }

    .ct-sub-app-cta__button {
        width: 100%;
        justify-content: center;
    }
}

/* ==========================================================================
   Form Elements
   ========================================================================== */

.ct-sub-field {
    margin-bottom: 20px;
}

.ct-sub-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ct-sub-dark);
    margin-bottom: 8px;
}

.ct-sub-input {
    width: 100%;
    padding: 16px 20px;
    font-family: var(--ct-sub-font);
    font-size: 16px;
    border: 2px solid var(--ct-sub-border);
    border-radius: var(--ct-sub-radius-sm);
    background: #fff;
    transition: all 0.2s;
    color: var(--ct-sub-dark);
}

.ct-sub-input::placeholder {
    color: #9CA3AF;
}

.ct-sub-input:focus {
    outline: none;
    border-color: var(--ct-sub-red);
    box-shadow: 0 0 0 4px rgba(239, 83, 80, 0.1);
}

.ct-sub-input.error {
    border-color: var(--ct-sub-error);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.ct-sub-field-error {
    display: block;
    font-size: 12px;
    color: var(--ct-sub-error);
    margin-top: 6px;
    min-height: 16px;
}

/* ==========================================================================
   Verification Code Input (Step 3)
   ========================================================================== */

.ct-sub-code-inputs {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 32px 0;
}

.ct-sub-code-input {
    width: 56px;
    height: 64px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    font-family: 'Monaco', 'Consolas', monospace;
    border: 2px solid var(--ct-sub-border);
    border-radius: var(--ct-sub-radius-sm);
    background: #fff;
    transition: all 0.2s;
    color: var(--ct-sub-dark);
}

.ct-sub-code-input:focus {
    outline: none;
    border-color: var(--ct-sub-red);
    box-shadow: 0 0 0 4px rgba(239, 83, 80, 0.1);
}

.ct-sub-code-input.filled {
    border-color: var(--ct-sub-success);
    background: #ECFDF5;
}

.ct-sub-code-input.error {
    border-color: var(--ct-sub-error);
    background: #FEE2E2;
    animation: codeShake 0.5s;
}

@keyframes codeShake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.ct-sub-resend {
    text-align: center;
    margin-top: 24px;
    font-size: 14px;
    color: var(--ct-sub-gray);
}

.ct-sub-resend-link {
    color: var(--ct-sub-red);
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    font-family: inherit;
    font-size: inherit;
    padding: 0;
}

.ct-sub-resend-link:hover {
    text-decoration: underline;
}

.ct-sub-resend-link:disabled {
    color: var(--ct-sub-gray);
    cursor: not-allowed;
}

/* ==========================================================================
   Plan Selection (Step 4)
   ========================================================================== */

.ct-sub-plans {
    display: grid;
    gap: 16px;
    margin-bottom: 24px;
}

.ct-sub-plan {
    position: relative;
    padding: 24px;
    background: #fff;
    border: 2px solid var(--ct-sub-border);
    border-radius: var(--ct-sub-radius);
    cursor: pointer;
    transition: all 0.2s;
}

.ct-sub-plan:hover {
    border-color: var(--ct-sub-gray);
}

.ct-sub-plan.selected {
    border-color: var(--ct-sub-red);
    background: linear-gradient(135deg, #fff 0%, #FEF2F2 100%);
}

.ct-sub-plan__badge {
    position: absolute;
    top: -10px;
    right: 16px;
    background: var(--ct-sub-red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 100px;
    letter-spacing: 0.5px;
}

.ct-sub-plan__badge--popular {
    background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
}

.ct-sub-plan__header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.ct-sub-plan__icon {
    width: 48px;
    height: 48px;
    background: var(--ct-sub-gray-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.ct-sub-plan.selected .ct-sub-plan__icon {
    background: var(--ct-sub-red);
    color: #fff;
}

.ct-sub-plan__name {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ct-sub-dark);
    margin: 0 0 4px;
}

.ct-sub-plan__desc {
    font-size: 13px;
    color: var(--ct-sub-gray);
    margin: 0;
}

.ct-sub-plan__features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
}

.ct-sub-plan__features li {
    font-size: 14px;
    color: var(--ct-sub-dark);
    padding: 6px 0;
    padding-left: 24px;
    position: relative;
}

.ct-sub-plan__features li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--ct-sub-success);
    font-weight: 700;
}

/* Billing Cycle Selection */
.ct-sub-billing {
    display: flex;
    gap: 8px;
    background: var(--ct-sub-gray-light);
    padding: 4px;
    border-radius: 100px;
    margin-bottom: 24px;
}

.ct-sub-billing__option {
    flex: 1;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 100px;
    font-family: var(--ct-sub-font);
    font-size: 14px;
    font-weight: 600;
    color: var(--ct-sub-gray);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.ct-sub-billing__option:hover {
    color: var(--ct-sub-dark);
}

.ct-sub-billing__option.active {
    background: #fff;
    color: var(--ct-sub-dark);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.ct-sub-billing__option small {
    display: block;
    font-size: 11px;
    font-weight: 400;
    color: var(--ct-sub-success);
    margin-top: 2px;
}

/* Price Display */
.ct-sub-price {
    text-align: center;
    padding: 24px;
    background: var(--ct-sub-gray-light);
    border-radius: var(--ct-sub-radius);
    margin-bottom: 24px;
}

.ct-sub-price__amount {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--ct-sub-dark);
}

.ct-sub-price__amount small {
    font-size: 1rem;
    font-weight: 400;
    color: var(--ct-sub-gray);
}

.ct-sub-price__trial {
    font-size: 14px;
    color: var(--ct-sub-success);
    font-weight: 600;
    margin-top: 8px;
}

/* Stripe Checkout Container */
.ct-sub-stripe-container {
    min-height: 400px;
    margin-bottom: 24px;
}

/* ==========================================================================
   Footer / Navigation
   ========================================================================== */

.ct-sub-dialog__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 32px;
    border-top: 1px solid var(--ct-sub-border);
    background: #fff;
    flex-shrink: 0;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.ct-sub-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: var(--ct-sub-font);
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 100px;
    cursor: pointer;
    transition: all 0.3s var(--ct-sub-ease);
}

.ct-sub-btn--primary {
    background: var(--ct-sub-red);
    color: #fff;
    margin-left: auto;
}

.ct-sub-btn--primary:hover {
    background: var(--ct-sub-red-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(239, 83, 80, 0.3);
}

.ct-sub-btn--primary:disabled {
    background: var(--ct-sub-gray);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ct-sub-btn--secondary {
    background: var(--ct-sub-gray-light);
    color: var(--ct-sub-dark);
}

.ct-sub-btn--secondary:hover {
    background: #E5E7EB;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.ct-sub-loading {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    z-index: 100;
    color: var(--ct-sub-dark);
    font-size: 15px;
    font-weight: 500;
}

.ct-sub-dialog.ct-sub--loading .ct-sub-loading {
    display: flex;
}

.ct-sub-loading__spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--ct-sub-gray-light);
    border-top-color: var(--ct-sub-red);
    border-radius: 50%;
    animation: ctSubSpin 0.8s linear infinite;
}

@keyframes ctSubSpin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Error Message
   ========================================================================== */

.ct-sub-error {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    background: #FEE2E2;
    color: var(--ct-sub-error);
    font-size: 14px;
    font-weight: 500;
}

.ct-sub-error.active {
    display: flex;
}

.ct-sub-error__icon {
    font-size: 20px;
    flex-shrink: 0;
}

.ct-sub-error__text {
    flex: 1;
}

.ct-sub-error__close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    padding: 4px;
}

.ct-sub-error__close:hover {
    opacity: 1;
}

/* ==========================================================================
   Success Screen
   ========================================================================== */

.ct-sub-success {
    text-align: center;
    padding: 60px 20px;
    max-width: 500px;
    margin: 0 auto;
}

.ct-sub-success__icon {
    width: 100px;
    height: 100px;
    background: var(--ct-sub-success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 300;
    margin: 0 auto 32px;
    animation: subSuccessPop 0.6s var(--ct-sub-ease);
}

@keyframes subSuccessPop {
    0% { transform: scale(0); opacity: 0; }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}

.ct-sub-success__title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ct-sub-dark);
    margin-bottom: 12px;
}

.ct-sub-success__message {
    font-size: 16px;
    color: var(--ct-sub-gray);
    margin-bottom: 32px;
    line-height: 1.6;
}

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

@media (max-width: 768px) {
    .ct-sub-dialog__header {
        padding: 16px 20px;
    }

    .ct-sub-dialog__title {
        font-size: 1.125rem;
    }

    .ct-sub-progress {
        padding: 16px 20px;
    }

    .ct-sub-progress__label {
        display: none;
    }

    .ct-sub-progress__number {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .ct-sub-progress__line {
        flex: 0 0 24px;
        margin-bottom: 0;
    }

    .ct-sub-steps {
        padding: 20px;
    }

    .ct-sub-dialog__footer {
        padding: 16px 20px;
        flex-direction: column-reverse;
    }

    .ct-sub-btn {
        width: 100%;
    }

    .ct-sub-btn--primary {
        margin-left: 0;
    }

    .ct-sub-code-inputs {
        gap: 8px;
    }

    .ct-sub-code-input {
        width: 44px;
        height: 52px;
        font-size: 20px;
    }

    .ct-sub-billing {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .ct-sub-progress__number {
        width: 28px;
        height: 28px;
        font-size: 11px;
    }

    .ct-sub-progress__line {
        flex: 0 0 16px;
    }

    .ct-sub-code-input {
        width: 38px;
        height: 48px;
        font-size: 18px;
    }
}
