/**
 * Caribbean Therapist - Popup Checkout Styles (v2)
 *
 * Wider 2-column layout, premium feel.
 * Colors fall back to Ziston theme settings if available.
 * Font-family inherits from Ziston's body typography.
 */

:root {
    --ct-primary:    var(--ziston-primary-color, var(--lt-primary, #006D77));
    --ct-secondary:  var(--ziston-secondary-color, var(--lt-secondary, #83C5BE));
    --ct-primary-d:  color-mix(in srgb, var(--ct-primary) 80%, black 20%);
    --ct-accent:     #E29578;
    --ct-bg:         #EDF6F9;
    --ct-text:       #1f2937;
    --ct-muted:      #6b7280;
    --ct-border:     #e5e7eb;
    --ct-error:      #dc2626;
    --ct-success:    #059669;
    --ct-radius:     14px;
    --ct-shadow:     0 20px 50px rgba(0, 0, 0, 0.18);
}

@supports not (color: color-mix(in srgb, red, blue)) {
    :root { --ct-primary-d: #004E54; }
}

.ct-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 32, 36, 0.7);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 999999;
    padding: 24px;
    opacity: 0;
    transition: opacity 0.3s ease;
    font-family: inherit;
}

.ct-popup-overlay.open { display: flex; opacity: 1; }
body.ct-popup-open    { overflow: hidden; }

.ct-popup {
    background: #fff;
    border-radius: var(--ct-radius);
    box-shadow: var(--ct-shadow);
    width: 100%;
    max-width: 820px;
    max-height: 92vh;
    overflow: hidden;
    position: relative;
    transform: translateY(24px) scale(0.98);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    color: var(--ct-text);
    font-family: inherit;
    display: flex;
    flex-direction: column;
}

.ct-popup-overlay.open .ct-popup {
    transform: translateY(0) scale(1);
}

.ct-popup-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 0;
    font-size: 26px;
    line-height: 1;
    color: var(--ct-text);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    font-family: inherit;
}

.ct-popup-close:hover {
    background: var(--ct-primary);
    color: #fff;
    transform: rotate(90deg);
}

/* Progress bar */
.ct-popup-progress {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, var(--ct-bg) 0%, #fff 100%);
    padding: 22px 36px;
    border-bottom: 1px solid var(--ct-border);
    gap: 10px;
    flex-shrink: 0;
}

.ct-step-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.ct-step-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #fff;
    color: var(--ct-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    border: 2px solid var(--ct-border);
    flex-shrink: 0;
}

.ct-step-indicator.active .ct-step-num {
    background: var(--ct-primary);
    color: #fff;
    border-color: var(--ct-primary);
    box-shadow: 0 4px 12px rgba(0, 109, 119, 0.3);
    transform: scale(1.05);
}

.ct-step-indicator.completed .ct-step-num {
    background: var(--ct-secondary);
    color: var(--ct-primary-d);
    border-color: var(--ct-secondary);
    font-size: 0;
    position: relative;
}

.ct-step-indicator.completed .ct-step-num::before {
    content: '✓';
    font-size: 18px;
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.ct-step-label {
    font-size: 13px;
    color: var(--ct-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    white-space: nowrap;
}

.ct-step-indicator.active .ct-step-label    { color: var(--ct-primary); }
.ct-step-indicator.completed .ct-step-label { color: var(--ct-primary-d); }

.ct-step-line {
    flex: 1;
    height: 2px;
    background: var(--ct-border);
    border-radius: 2px;
    min-width: 30px;
    transition: background 0.3s;
}

.ct-step-indicator.completed + .ct-step-line { background: var(--ct-secondary); }

/* Body */
.ct-popup-body {
    overflow-y: auto;
    flex: 1;
}

.ct-popup-step {
    display: none;
    animation: ct-fade-in 0.4s ease;
}

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

@keyframes ct-fade-in {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ct-popup-heading {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--ct-text);
    letter-spacing: -0.02em;
    font-family: inherit;
}

.ct-popup-sub {
    font-size: 15px;
    color: var(--ct-muted);
    margin: 0 0 28px;
}

.ct-popup-sub a {
    color: var(--ct-primary);
    text-decoration: none;
    font-weight: 600;
}

.ct-popup-sub a:hover { text-decoration: underline; }

/* STEP 1: Two-column grid */
.ct-step-grid {
    display: grid;
    grid-template-columns: 1fr 320px;
    min-height: 480px;
}

.ct-step-main { padding: 40px 44px; }

.ct-step-aside {
    background: linear-gradient(160deg, var(--ct-bg) 0%, #fff 100%);
    padding: 40px 32px;
    border-left: 1px solid var(--ct-border);
    display: flex;
    flex-direction: column;
}

.ct-aside-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--ct-muted);
    margin: 0 0 16px;
}

.ct-aside-card {
    background: #fff;
    border: 1.5px solid var(--ct-secondary);
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 4px 16px rgba(0, 109, 119, 0.08);
}

.ct-aside-pkg-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--ct-primary-d);
    margin: 0 0 4px;
}

.ct-aside-pkg-price {
    font-size: 30px;
    font-weight: 800;
    color: var(--ct-primary);
    margin: 0 0 12px;
    line-height: 1;
}

.ct-aside-pkg-price .ct-price-period {
    font-size: 13px;
    font-weight: 500;
    color: var(--ct-muted);
    display: block;
    margin-top: 4px;
}

.ct-aside-features {
    list-style: none;
    padding: 0;
    margin: 16px 0 0;
    border-top: 1px solid var(--ct-border);
    padding-top: 16px;
}

.ct-aside-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 5px 0;
    font-size: 13px;
    color: var(--ct-text);
}

.ct-aside-features li::before {
    content: '✓';
    color: var(--ct-primary);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.ct-aside-trust {
    margin-top: auto;
    padding-top: 24px;
    font-size: 12px;
    color: var(--ct-muted);
    line-height: 1.6;
}

.ct-aside-trust strong {
    display: block;
    color: var(--ct-text);
    margin-bottom: 4px;
    font-size: 13px;
}

/* Forms */
.ct-form .ct-form-group,
.ct-form .ct-form-row { margin-bottom: 18px; }

.ct-form-row { display: flex; gap: 14px; }
.ct-form-row-between { justify-content: space-between; align-items: center; }
.ct-form-col { flex: 1; }

.ct-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--ct-text);
    margin-bottom: 7px;
    font-family: inherit;
}

.ct-form input[type="text"],
.ct-form input[type="email"],
.ct-form input[type="password"],
.ct-form input[type="tel"] {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid var(--ct-border);
    border-radius: 10px;
    font-size: 15px;
    background: #fff;
    color: var(--ct-text);
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.ct-form input:focus {
    outline: none;
    border-color: var(--ct-primary);
    box-shadow: 0 0 0 3px rgba(0, 109, 119, 0.12);
}

.ct-hint {
    display: block;
    font-size: 12px;
    color: var(--ct-muted);
    margin-top: 5px;
}

.ct-checkbox label,
.ct-checkbox-inline {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: var(--ct-muted);
    cursor: pointer;
    line-height: 1.5;
}

.ct-checkbox-inline { align-items: center; margin: 0; }

.ct-checkbox input[type="checkbox"],
.ct-checkbox-inline input[type="checkbox"] {
    margin-top: 3px;
    width: 17px;
    height: 17px;
    accent-color: var(--ct-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.ct-checkbox-inline input[type="checkbox"] { margin-top: 0; }

.ct-checkbox a { color: var(--ct-primary); }

.ct-link-small {
    font-size: 13px;
    color: var(--ct-primary);
    text-decoration: none;
    font-weight: 500;
}

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

.ct-form-error {
    display: none;
    background: #fef2f2;
    border-left: 3px solid var(--ct-error);
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 16px;
}

/* Buttons */
.ct-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    border: 0;
    text-decoration: none;
    transition: all 0.2s ease;
    line-height: 1;
    font-family: inherit;
}

.ct-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ct-btn-primary {
    background: var(--ct-primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0, 109, 119, 0.2);
}

.ct-btn-primary:hover:not(:disabled) {
    background: var(--ct-primary-d);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(0, 109, 119, 0.3);
    color: #fff;
}

.ct-btn-link {
    background: transparent;
    color: var(--ct-muted);
    padding: 8px 0;
    font-size: 14px;
    font-weight: 500;
}

.ct-btn-link:hover:not(:disabled) { color: var(--ct-primary); }

.ct-btn-full { width: 100%; padding: 15px 28px; font-size: 16px; }
.ct-btn-small { padding: 9px 18px; font-size: 13px; }

.ct-btn-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ct-spin 0.8s linear infinite;
    display: inline-block;
}

@keyframes ct-spin { to { transform: rotate(360deg); } }

/* Step 2 / 3 - centered single column */
.ct-step-2 .ct-popup-step-inner,
.ct-step-3 .ct-popup-step-inner {
    padding: 48px 60px;
    max-width: 560px;
    margin: 0 auto;
}

.ct-confirm-card {
    background: linear-gradient(135deg, var(--ct-bg) 0%, #fff 100%);
    border: 2px solid var(--ct-secondary);
    border-radius: var(--ct-radius);
    padding: 32px;
    margin-bottom: 24px;
    text-align: center;
}

.ct-confirm-pkg-name {
    font-size: 26px;
    font-weight: 700;
    color: var(--ct-primary-d);
    margin-bottom: 8px;
    font-family: inherit;
}

.ct-confirm-pkg-price {
    font-size: 38px;
    font-weight: 800;
    color: var(--ct-primary);
    margin-bottom: 20px;
    line-height: 1;
}

.ct-confirm-pkg-price .ct-price-period {
    font-size: 14px;
    font-weight: 500;
    color: var(--ct-muted);
    margin-left: 6px;
}

.ct-confirm-features {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: left;
    border-top: 1px solid rgba(0, 109, 119, 0.15);
    padding-top: 20px;
}

.ct-confirm-features li {
    padding: 8px 0;
    color: var(--ct-text);
    font-size: 14px;
}

/* Step 3 - success */
.ct-success-state {
    text-align: center;
    padding: 32px 0;
}

.ct-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: var(--ct-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: var(--ct-primary-d);
    font-weight: 700;
    animation: ct-pop 0.5s ease;
    box-shadow: 0 8px 20px rgba(131, 197, 190, 0.4);
}

@keyframes ct-pop {
    from { transform: scale(0); }
    60%  { transform: scale(1.15); }
    to   { transform: scale(1); }
}

.ct-success-msg {
    color: var(--ct-muted);
    margin-bottom: 28px;
    font-size: 15px;
}

.ct-loader {
    width: 36px;
    height: 36px;
    border: 3px solid var(--ct-bg);
    border-top-color: var(--ct-primary);
    border-radius: 50%;
    animation: ct-spin 0.8s linear infinite;
    margin: 0 auto;
}

/* Already-logged-in state */
.ct-already-loggedin {
    background: var(--ct-bg);
    padding: 18px;
    border-radius: 10px;
    margin-top: 20px;
}

.ct-already-loggedin p {
    margin: 0 0 14px;
    font-size: 14px;
    color: var(--ct-text);
}

/* Mobile */
@media (max-width: 800px) {
    .ct-step-grid { grid-template-columns: 1fr; }
    .ct-step-aside { border-left: 0; border-top: 1px solid var(--ct-border); padding: 28px 32px; }
    .ct-step-main  { padding: 32px 32px 24px; }
    .ct-popup { max-width: 560px; }
}

@media (max-width: 600px) {
    .ct-popup-overlay { padding: 0; align-items: flex-end; }
    .ct-popup {
        max-height: 95vh;
        max-width: 100%;
        border-radius: 18px 18px 0 0;
    }
    .ct-popup-progress { padding: 16px 20px; gap: 6px; }
    .ct-step-label     { display: none; }
    .ct-step-num       { width: 30px; height: 30px; font-size: 13px; }
    .ct-step-main      { padding: 24px 20px; }
    .ct-step-aside     { padding: 20px; }
    .ct-popup-heading  { font-size: 22px; }
    .ct-step-2 .ct-popup-step-inner,
    .ct-step-3 .ct-popup-step-inner { padding: 32px 20px; }
    .ct-form-row       { flex-direction: column; gap: 0; }
    .ct-form-row .ct-form-col { margin-bottom: 14px; }
    .ct-form-row.ct-form-row-between { flex-direction: row; }
}
