/* =============================================================
   Membership Form Widget — Single-Page Layout
   ============================================================= */

/* ── Wrapper ── */
.ms-form-wrap {
    max-width: 700px;
    margin: 0 auto;
    font-family: inherit;
    color: #1f2937;
}

/* ── Section ── */
.ms-section {
    padding: 32px 0;
}

.ms-section-divider {
    border: none;
    border-top: 1.5px solid #f0f0f0;
    margin: 0;
}

/* ── Section Title ── */
.ms-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 22px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ms-section-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #16a34a;
    flex-shrink: 0;
}

.ms-section-icon-wrap svg {
    width: 20px;
    height: 20px;
}

/* =============================================================
   PLAN CARDS — 2 × 2 Grid, horizontal row layout
   ============================================================= */
.ms-plans-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.ms-plan-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.15s;
    outline: none;
    user-select: none;
    position: relative;
}

.ms-plan-card:hover {
    border-color: #bbf7d0;
    box-shadow: 0 2px 12px rgba(22, 163, 74, 0.08);
}

.ms-plan-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.25);
}

.ms-plan-card.selected {
    border-color: #16a34a;
    box-shadow: 0 2px 16px rgba(22, 163, 74, 0.15);
    background: #f0fdf4;
}

/* ── Plan Icon ── */
.ms-plan-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.ms-plan-icon-wrap svg {
    width: 20px;
    height: 20px;
}

.ms-plan-card.selected .ms-plan-icon-wrap {
    background: #16a34a;
    color: #fff;
}

/* ── Plan Info ── */
.ms-plan-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ms-plan-name {
    font-size: 15px;
    font-weight: 700;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ms-plan-price-line {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 13px;
    color: #6b7280;
}

.ms-plan-price-line strong {
    font-weight: 700;
    color: #374151;
}

.ms-plan-period {
    font-size: 12px;
    color: #9ca3af;
}

/* ── Selected Checkmark ── */
.ms-plan-check {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
}

.ms-plan-check svg {
    width: 12px;
    height: 12px;
    color: transparent;
    transition: color 0.2s;
}

.ms-plan-card.selected .ms-plan-check {
    background: #16a34a;
    border-color: #16a34a;
}

.ms-plan-card.selected .ms-plan-check svg {
    color: #fff;
}

/* =============================================================
   PERSONAL INFORMATION FORM
   ============================================================= */
.ms-info-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ms-row {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.ms-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.ms-field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ms-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 4px;
}

.ms-label-hint {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

.ms-req {
    color: #ef4444;
}

.ms-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
}

.ms-input::placeholder {
    color: #9ca3af;
}

.ms-input:focus {
    outline: none;
    border-color: #16a34a;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.12);
}

.ms-input.ms-invalid {
    border-color: #ef4444;
    box-shadow: none;
}

.ms-field-error {
    font-size: 12px;
    color: #ef4444;
    min-height: 16px;
}

.ms-field-error[hidden] {
    display: none;
}

/* =============================================================
   PAYMENT — TABS
   ============================================================= */
.ms-pay-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.ms-pay-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #6b7280;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    font-family: inherit;
}

.ms-pay-tab:hover {
    border-color: #bbf7d0;
    color: #374151;
}

.ms-pay-tab.active {
    border-color: #16a34a;
    color: #16a34a;
}

/* Stripe "S" badge */
.ms-stripe-s {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #635bff;
    color: #fff;
    font-size: 12px;
    font-weight: 800;
    border-radius: 4px;
    font-family: Arial, sans-serif;
}

.ms-pay-tab.active .ms-stripe-s {
    background: #16a34a;
}

/* Credit card icon in tab */
.ms-tab-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ── Tab Panels ── */
.ms-tab-panel[hidden] {
    display: none;
}

.ms-tab-panel.active {
    display: block;
}

/* ── Card element wrapper ── */
.ms-card-element-wrap {
    border: 2px dashed #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    background: #fafafa;
    margin-bottom: 16px;
    transition: border-color 0.2s;
}

.ms-card-element-wrap:focus-within {
    border-color: #16a34a;
    border-style: solid;
    background: #fff;
}

.ms-card-element-wrap--plain {
    border-style: solid;
}

.ms-stripe-brand {
    display: flex;
    align-items: center;
    margin-bottom: 14px;
}

/* Stripe Elements mount target */
.ms-card-element {
    padding: 4px 2px;
}

/* ── Order summary ── */
.ms-order-summary {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
}

.ms-order-summary[hidden] {
    display: none;
}

.ms-summary-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    flex-wrap: wrap;
}

.ms-summary-label {
    color: #6b7280;
}

.ms-summary-plan-name {
    color: #111827;
    font-weight: 600;
}

.ms-summary-sep {
    color: #9ca3af;
}

.ms-summary-amount {
    color: #16a34a;
    font-size: 16px;
    font-weight: 800;
}

/* =============================================================
   SUBMIT BUTTON
   ============================================================= */
.ms-submit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    background: #16a34a;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s, transform 0.15s;
    font-family: inherit;
    margin-bottom: 14px;
}

.ms-submit-btn:hover:not(:disabled) {
    background: #15803d;
    transform: translateY(-1px);
}

.ms-submit-btn:active:not(:disabled) {
    transform: none;
}

.ms-submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ms-btn-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.ms-btn-text {
    flex: 1;
    text-align: center;
}

/* ── Spinner ── */
.ms-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ms-spin 0.65s linear infinite;
    flex-shrink: 0;
}

.ms-spinner[hidden] { display: none; }

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

/* ── Secure note ── */
.ms-secure-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

.ms-secure-note svg {
    flex-shrink: 0;
    color: #9ca3af;
}

/* =============================================================
   ERROR / NOTICE
   ============================================================= */
.ms-plan-error,
.ms-card-error,
.ms-global-error {
    font-size: 13px;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 10px 14px;
    margin-top: 10px;
}

.ms-plan-error[hidden],
.ms-card-error[hidden],
.ms-global-error[hidden] {
    display: none;
}

/* =============================================================
   SUCCESS STATE
   ============================================================= */
.ms-success-panel {
    text-align: center;
    padding: 60px 20px;
    animation: ms-fade-in 0.5s ease;
}

.ms-success-panel[hidden] {
    display: none;
}

.ms-success-icon {
    width: 72px;
    height: 72px;
    background: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
}

.ms-success-icon svg {
    width: 36px;
    height: 36px;
    color: #16a34a;
    stroke: #16a34a;
}

.ms-success-title {
    font-size: 26px;
    font-weight: 800;
    color: #111827;
    margin: 0 0 10px;
}

.ms-success-msg {
    font-size: 15px;
    color: #6b7280;
    max-width: 380px;
    margin: 0 auto;
    line-height: 1.7;
}

/* =============================================================
   ANIMATIONS
   ============================================================= */
@keyframes ms-fade-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   EDITOR PREVIEW
   ============================================================= */
.ms-editor-preview .ms-editor-notice {
    border: 2px dashed #d1d5db;
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
    line-height: 1.8;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 580px) {
    .ms-plans-grid {
        grid-template-columns: 1fr;
    }

    .ms-row-2 {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .ms-section-title {
        font-size: 14px;
    }

    .ms-submit-btn {
        font-size: 13px;
        padding: 14px 16px;
    }
}
