/* =============================================================
   TMK – PMPro Multi-Step Checkout  |  Dark Premium Theme
   ============================================================= */

/* ── Variables ─────────────────────────────────────────────── */
body.pmpro-checkout {
    --bg: #0d0d14;
    --surface: #16161f;
    --surface-2: #1e1e2a;
    --surface-3: #252534;
    --border: rgba(255, 255, 255, 0.07);
    --border-hover: rgba(255, 255, 255, 0.14);
    --accent: #58b947;
    --accent-dim: rgba(39, 200, 21, 0.18);
    --accent-glow: rgb(31, 97, 19);
    --accent-hover: rgb(31, 97, 19);
    --green: #27ae6a;
    --green-dim: rgba(39, 174, 106, 0.15);
    --text: #eeeef5;
    --text-2: #9898b0;
    --text-3: #5c5c78;
    --label: #7878a0;
    --input-bg: #0f0f18;
    --radius: 14px;
    --radius-sm: 8px;
    --radius-xs: 5px;
    --shadow: 0 8px 40px rgba(0, 0, 0, 0.55);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.4);
    --ease: 0.2s ease;
}

/* ── Page reset ─────────────────────────────────────────────── */
body.pmpro-checkout {
    background: var(--bg) !important;
    color: var(--text);
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── Outer wrapper ──────────────────────────────────────────── */
body.pmpro-checkout .pmpro {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px 80px;
}

/* ── Step Indicator ─────────────────────────────────────────── */
.tmk-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 36px 0 44px;
    position: relative;
}

.tmk-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.tmk-step-line {
    flex: 1;
    height: 2px;
    background: var(--surface-3);
    min-width: 80px;
    max-width: 140px;
    transition: background 0.4s ease;
}

.tmk-step-line.done {
    background: linear-gradient(90deg, var(--accent), #135303);
}

.tmk-step-dot {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    border: 2px solid var(--surface-3);
    background: var(--surface-2);
    color: var(--text-3);
    transition: all 0.3s ease;
    position: relative;
}

.tmk-step.active .tmk-step-dot {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 0 0 6px var(--accent-dim);
}

.tmk-step.done .tmk-step-dot {
    background: var(--surface-3);
    border-color: var(--accent);
    color: var(--accent);
}

.tmk-step.done .tmk-step-dot::after {
    content: '✓';
    position: absolute;
}

.tmk-step.done .tmk-step-num {
    display: none;
}

.tmk-step-label {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    color: var(--text-3);
    transition: color 0.3s;
    white-space: nowrap;
}

.tmk-step.active .tmk-step-label {
    color: var(--text);
}

.tmk-step.done .tmk-step-label {
    color: var(--accent);
}

/* ── Layout: two-column ─────────────────────────────────────── */
.tmk-checkout-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 24px;
    align-items: start;
}

/* ── Left: form column ──────────────────────────────────────── */
.tmk-form-col {
    min-width: 0;
}

/* ── Section heading inside card ───────────────────────────── */
.tmk-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 20px;
    transition: border-color var(--ease);
}

.tmk-card:hover {
    border-color: var(--border-hover);
}

.tmk-card-header {
    padding: 22px 26px 0;
}

.tmk-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
    letter-spacing: 0.01em;
}

.tmk-card-subtitle {
    font-size: 0.82rem;
    color: var(--text-2);
    margin: 0 0 18px;
}

.tmk-card-body {
    padding: 20px 26px 26px;
}

/* ── Custom Alert / Error Banner (AJAX) ───────────────────────── */
.tmk-alert-banner {
    display: none; /* JS will toggle flex */
    align-items: flex-start;
    border-radius: 18px;
    padding: 22px 28px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.tmk-alert-error {
    background-color: rgba(243, 156, 18, 0.08);
    border: 1px solid rgba(243, 156, 18, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.tmk-alert-error::before {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(243, 156, 18, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.tmk-alert-success {
    background-color: rgba(88, 185, 71, 0.08);
    border: 1px solid rgba(88, 185, 71, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.tmk-alert-success::before {
    content: '';
    position: absolute;
    right: -20px;
    bottom: -20px;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(88, 185, 71, 0.08) 0%, transparent 60%);
    pointer-events: none;
}

.tmk-alert-icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 18px;
    flex-shrink: 0;
    font-weight: 800;
    font-size: 20px;
}

.tmk-alert-error .tmk-alert-icon {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    color: #111;
    box-shadow: 0 4px 12px rgba(230, 126, 34, 0.2);
}

.tmk-alert-success .tmk-alert-icon {
    background: linear-gradient(135deg, #61CE70, #58B947);
    color: #111;
    box-shadow: 0 4px 12px rgba(88, 185, 71, 0.3);
}

.tmk-alert-content {
    display: flex;
    flex-direction: column;
    z-index: 1;
}

.tmk-alert-title {
    font-weight: 700;
    font-size: 1.15rem;
    margin: 0 0 5px 0;
    line-height: 1.2;
}

.tmk-alert-error .tmk-alert-title { color: #f5b041; }
.tmk-alert-success .tmk-alert-title { color: #61CE70; }

.tmk-alert-description {
    font-weight: 400;
    font-size: 0.95rem;
    color: var(--text-text);
    line-height: 1.55;
    margin: 0;
}

/* ── Alert banner (Legacy PMPro) ────────────────────────────── */
.tmk-alert {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 0.875rem;
    line-height: 1.55;
}

.tmk-alert-warn {
    background: rgba(230, 160, 30, 0.12);
    border: 1px solid rgba(230, 160, 30, 0.25);
    color: #e6a01e;
}

.tmk-alert-success {
    background: var(--green-dim);
    border: 1px solid rgba(39, 174, 106, 0.3);
    color: var(--green);
}

.tmk-alert-title {
    font-weight: 700;
    margin-bottom: 2px;
}

.tmk-alert-body {
    color: inherit;
    opacity: 0.85;
}

/* ── Form grid ──────────────────────────────────────────────── */
.tmk-form-grid {
    display: grid;
    gap: 18px;
}

.tmk-form-grid.cols-2 {
    grid-template-columns: 1fr 1fr;
}

.tmk-form-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.tmk-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.tmk-field label {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--label);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tmk-field input,
.tmk-field select,
body.pmpro-checkout .pmpro_form_input,
body.pmpro-checkout input[type="text"],
body.pmpro-checkout input[type="email"],
body.pmpro-checkout input[type="password"],
body.pmpro-checkout select {
    background: var(--input-bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text) !important;
    padding: 12px 15px !important;
    font-size: 0.935rem !important;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border-color var(--ease), box-shadow var(--ease);
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
}

.tmk-field input:focus,
.tmk-field select:focus,
body.pmpro-checkout input[type="text"]:focus,
body.pmpro-checkout input[type="email"]:focus,
body.pmpro-checkout input[type="password"]:focus,
body.pmpro-checkout select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

body.pmpro-checkout input::placeholder {
    color: var(--text-3) !important;
}

/* Card number special styling */
.tmk-card-field {
    position: relative;
}

.tmk-card-field input {
    padding-right: 80px !important;
}

.tmk-card-field-brands {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    gap: 5px;
    align-items: center;
    pointer-events: none;
}

.tmk-card-field-brands span {
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    padding: 2px 5px;
    border-radius: 3px;
    border: 1px solid var(--border);
}

.tmk-brand-visa {
    color: #1a73e8;
}

.tmk-brand-mc {
    color: #0a9a22;
}

/* Select chevron */
body.pmpro-checkout select,
.tmk-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237878a0' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 13px center !important;
    padding-right: 36px !important;
    cursor: pointer;
}

/* ── Password toggle ────────────────────────────────────────── */
.tmk-pw-wrap {
    position: relative;
}

.tmk-pw-wrap input {
    padding-right: 48px !important;
}

body.pmpro-checkout .pmpro_btn-password-toggle {
    position: absolute;
    right: 13px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    opacity: 0.45;
    transition: opacity var(--ease);
    color: var(--text-2);
}

body.pmpro-checkout .pmpro_btn-password-toggle:hover {
    opacity: 1;
}

body.pmpro-checkout .pmpro_form_field-password-toggle-state {
    display: none;
}

/* ── Step panels (JS controlled) ────────────────────────────── */
.tmk-step-panel {
    position: absolute;
    left: -9999px;
    top: 0;
    width: 100%;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease;
}

.tmk-step-panel.active {
    position: static;
    left: auto;
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.tmk-form-col {
    position: relative;
    min-width: 0;
}

/* ── Step navigation buttons ────────────────────────────────── */
.tmk-nav-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0 0;
    gap: 12px;
}

.tmk-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    cursor: pointer;
    border: none;
    transition: all var(--ease);
}

.tmk-btn-primary {
    background: linear-gradient(135deg, #61CE70 0%, #58B947 100%);
    color: #fff;
    box-shadow: 0 4px 18px rgba(88, 185, 71, 0.35);
}

.tmk-btn-primary:hover {
    background: linear-gradient(135deg, #74db81 0%, #61CE70 100%);
    box-shadow: 0 6px 26px rgba(88, 185, 71, 0.55);
    transform: translateY(-1px);
}

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

.tmk-btn-ghost {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
}

.tmk-btn-ghost:hover {
    background: var(--surface-3);
    border-color: var(--border-hover);
    color: var(--text);
}

/* ── Right: sticky sidebar ──────────────────────────────────── */
.tmk-sidebar {
    position: sticky;
    top: 90px;
}

.tmk-summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.tmk-summary-head {
    padding: 22px 24px 18px;
    border-bottom: 1px solid var(--border);
}

.tmk-summary-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-2);
    margin: 0 0 14px;
}

.tmk-summary-level {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tmk-summary-level-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.tmk-summary-level-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.tmk-summary-level-desc {
    font-size: 0.8rem;
    color: var(--text-2);
    margin-top: 2px;
}

.tmk-summary-rows {
    padding: 18px 24px 0;
}

.tmk-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.tmk-summary-row:last-child {
    border-bottom: none;
}

.tmk-summary-row-label {
    color: var(--text-2);
}

.tmk-summary-row-value {
    color: var(--text);
    font-weight: 600;
}

.tmk-summary-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 24px;
    border-top: 1px solid var(--border);
    margin-top: 2px;
}

.tmk-summary-total-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
}

.tmk-summary-total-value {
    font-size: 1.3rem;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.02em;
}

/* ── Sidebar CTA block ──────────────────────────────────────── */
.tmk-sidebar-cta {
    padding: 0 24px 24px;
}

/* ── TOS Checkbox (injected by PMPro hooks) ────────────── */
body.pmpro-checkout #pmpro_tos_fields {
    margin-bottom: 16px;
    padding: 0 0 10px;
}

body.pmpro-checkout #pmpro_tos_fields label.pmpro_form_label {
    display: inline-flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    font-size: 0.9rem !important;
    color: var(--text-2) !important;
    line-height: 1.55 !important;
    margin: 0 !important;
    cursor: pointer;
    max-width: fit-content;
}

body.pmpro-checkout #pmpro_tos_fields input[type="checkbox"] {
    -webkit-appearance: none !important;
    appearance: none !important;
    width: 13px !important;
    height: 13px !important;
    min-width: 13px !important;
    min-height: 13px !important;
    max-width: 13px !important;
    max-height: 13px !important;
    padding: 0 !important;
    margin: 3px 0 0 !important;
    background-color: var(--input-bg) !important;
    border: 1px solid var(--label) !important;
    border-radius: 3px !important;
    cursor: pointer !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    display: inline-block !important;
    box-shadow: none !important;
    flex-shrink: 0 !important;
}

body.pmpro-checkout #pmpro_tos_fields input[type="checkbox"]:checked {
    background-color: var(--accent) !important;
    border-color: var(--accent) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-size: 9px !important;
}

body.pmpro-checkout #pmpro_tos_fields a {
    color: var(--accent) !important;
    text-decoration: none !important;
}

body.pmpro-checkout #pmpro_tos_fields a:hover {
    text-decoration: underline !important;
}

/* Full-width sidebar submit */
body.pmpro-checkout #pmpro_btn-submit,
body.pmpro-checkout input[type="submit"].pmpro_btn-submit-checkout,
.tmk-submit-btn {
    display: block;
    width: 100%;
    padding: 15px 20px !important;
    background: linear-gradient(135deg, #61CE70 0%, #58B947 100%) !important;
    color: #fff !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    font-size: 0.975rem !important;
    font-weight: 700 !important;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 18px rgba(88, 185, 71, 0.35);
    text-align: center;
    transition: all var(--ease);
}

body.pmpro-checkout #pmpro_btn-submit:hover,
body.pmpro-checkout input[type="submit"].pmpro_btn-submit-checkout:hover,
.tmk-submit-btn:hover {
    background: linear-gradient(135deg, #74db81 0%, #61CE70 100%) !important;
    box-shadow: 0 6px 28px rgba(88, 185, 71, 0.55);
    transform: translateY(-1px);
}

.tmk-secure-note {
    text-align: center;
    font-size: 0.74rem;
    color: var(--text-3);
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* ── Discount code strip ────────────────────────────────────── */
.tmk-discount-strip {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
}

.tmk-discount-strip label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--label);
    letter-spacing: 0.07em;
    text-transform: uppercase;
    display: block;
    margin-bottom: 8px;
}

.tmk-discount-inline {
    display: flex;
    gap: 8px;
}

.tmk-discount-inline input {
    flex: 1;
    background: var(--input-bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-xs) !important;
    color: var(--text) !important;
    padding: 10px 13px !important;
    font-size: 0.875rem !important;
    outline: none;
    transition: border-color var(--ease);
}

.tmk-discount-inline input:focus {
    border-color: var(--accent) !important;
}

.tmk-discount-inline button {
    padding: 10px 16px;
    background: var(--surface-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-xs);
    color: var(--text-2);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--ease);
}

.tmk-discount-inline button:hover {
    background: var(--surface-3);
    border-color: var(--border-hover);
    color: var(--text);
}

/* ── Messages ───────────────────────────────────────────────── */
body.pmpro-checkout #pmpro_message,
body.pmpro-checkout #pmpro_message_bottom {
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-size: 0.875rem;
    margin-bottom: 16px;
}

body.pmpro-checkout .pmpro_error {
    background: rgba(229, 9, 20, 0.1);
    border: 1px solid rgba(229, 9, 20, 0.35);
    color: #ff6b6b;
}

body.pmpro-checkout .pmpro_success {
    background: var(--green-dim);
    border: 1px solid rgba(39, 174, 106, 0.35);
    color: #6bcf8e;
}

body.pmpro-checkout .pmpro_message {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-2);
}

/* ── Logged in notice ───────────────────────────────────────── */
body.pmpro-checkout #pmpro_account_loggedin {
    font-size: 0.875rem;
    color: var(--text-2);
    line-height: 1.6;
    padding: 4px 0;
}

body.pmpro-checkout #pmpro_account_loggedin strong {
    color: var(--text);
}

body.pmpro-checkout #pmpro_account_loggedin a {
    color: var(--accent);
    text-decoration: none;
}

body.pmpro-checkout #pmpro_account_loggedin a:hover {
    text-decoration: underline;
}

/* ── Legacy PMPro elements hidden/reset ─────────────────────── */
body.pmpro-checkout .pmpro_hidden {
    display: none !important;
}

body.pmpro-checkout .pmpro_form_fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

body.pmpro-checkout .pmpro_section {
    background: transparent;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 860px) {
    .tmk-checkout-layout {
        grid-template-columns: 1fr;
    }

    .tmk-sidebar {
        position: static;
    }

    .tmk-step-line {
        min-width: 40px;
    }
}

@media (max-width: 560px) {

    .tmk-form-grid.cols-2,
    .tmk-form-grid.cols-3 {
        grid-template-columns: 1fr;
    }

    .tmk-card-body {
        padding: 16px 18px 20px;
    }

    .tmk-card-header {
        padding: 18px 18px 0;
    }

    .tmk-step-label {
        display: none;
    }

    .tmk-step-line {
        min-width: 24px;
    }
}

/* ── Premium Plan Info Card ─────────────────────────────────── */
.tmk-card--premium {
    border-color: rgba(88, 185, 71, 0.3);
    border-top: 3px solid var(--accent);
    box-shadow: var(--shadow-sm), 0 0 24px rgba(88, 185, 71, 0.08);
    position: relative;
    overflow: hidden;
}

.tmk-card--premium::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 160px;
    height: 160px;
    background: radial-gradient(circle, rgba(88, 185, 71, 0.07) 0%, transparent 65%);
    pointer-events: none;
    border-radius: 50%;
}