/**
 * Betasahm Membership Styles
 * Premium Financial App Aesthetic with Semantic State Tokens
 * Implements directives from UI/UX design reviews
 */

:root {
    /* Semantic State Tokens */
    --color-success: #22c55e;
    --color-success-bg: #f0fdf4;
    --color-success-text: #166534;
    --color-success-border: #bbf7d0;

    --color-warning: #f59e0b;
    --color-warning-bg: #fffbeb;
    --color-warning-text: #92400e;
    --color-warning-border: #fde68a;

    --color-danger: #ef4444;
    --color-danger-bg: #fef2f2;
    --color-danger-text: #991b1b;
    --color-danger-border: #fecaca;

    --color-info: #3b82f6;
    --color-info-bg: #eff6ff;
    --color-info-text: #1e40af;
    --color-info-border: #bfdbfe;

    --action-primary: var(--button-dark, #1f2937);
}

.bs-membership-container {
    direction: rtl;
    text-align: right;
    font-family: inherit;
    color: var(--dark-text, #111827);
    margin: 20px 0;
}

/* Status Cards & Badges */
.bs-card {
    background: var(--card-white, #ffffff);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Neutral Card with subtle state accents */
.bs-card-membership {
    position: relative;
    border-right: 4px solid var(--border-light, #e5e7eb);
}

.bs-card-membership.bs-state-active {
    border-right-color: var(--color-success);
}

.bs-card-membership.bs-state-warning {
    border-right-color: var(--color-warning);
    background: var(--color-warning-bg);
}

.bs-card-membership.bs-state-scheduled {
    border-right-color: var(--color-info);
}

.bs-card-membership.bs-state-expired {
    border-right-color: var(--border-light);
    background: var(--card-white);
}

.bs-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.bs-status-badge.bs-active {
    background: var(--color-success-bg);
    color: var(--color-success-text);
    border: 1px solid var(--color-success-border);
}

.bs-status-badge.bs-warning {
    background: var(--color-warning-bg);
    color: var(--color-warning-text);
    border: 1px solid var(--color-warning-border);
}

.bs-status-badge.bs-scheduled {
    background: var(--color-info-bg);
    color: var(--color-info-text);
    border: 1px solid var(--color-info-border);
}

.bs-status-badge.bs-expired {
    background: var(--inner-box-gray, #f3f4f6);
    color: var(--text-muted, #6b7280);
    border: 1px solid var(--border-light, #e5e7eb);
}

.bs-status-badge.bs-failed {
    background: var(--color-danger-bg);
    color: var(--color-danger-text);
    border: 1px solid var(--color-danger-border);
}

/* Contextual Plan Card List */
.bs-plans-horizontal-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 20px;
}

.bs-plan-row-card {
    background: var(--card-white, #ffffff);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    transition: all 0.2s ease;
}

.bs-plan-row-card:hover {
    border-color: var(--action-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.bs-plan-row-card.bs-selected {
    border-color: var(--action-primary);
    background: var(--inner-box-light-gray, #fcfcfc);
}

.bs-plan-row-info {
    flex: 1;
}

.bs-plan-row-title {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    color: var(--headings, #0f172a);
    display: flex;
    align-items: center;
    gap: 10px;
}

.bs-plan-row-badge {
    background: var(--action-primary);
    color: #ffffff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 6px;
    font-weight: 600;
}

.bs-plan-row-desc {
    margin: 0;
    font-size: 0.88rem;
    color: var(--text-muted, #6b7280);
}

.bs-plan-row-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--headings, #0f172a);
    white-space: nowrap;
}

.bs-plan-row-action {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .bs-plan-row-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .bs-plan-row-action {
        width: 100%;
    }
    .bs-plan-row-action .bs-btn {
        width: 100%;
    }
}

/* Contextual Progressive Inline Checkout Panel (No Wizard Header) */
.bs-inline-checkout-box {
    background: var(--card-white, #ffffff);
    border: 1px solid var(--border-light, #e5e7eb);
    border-radius: 12px;
    padding: 28px;
    margin-top: 24px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.04);
    display: none;
    animation: bsFadeIn 0.2s ease-out;
}

@keyframes bsFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.bs-checkout-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.bs-checkout-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--headings, #0f172a);
}

.bs-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border-light, #e5e7eb);
    font-size: 0.95rem;
}

/* Visual Anchor for Final Amount */
.bs-summary-final-row {
    font-size: 1.3rem;
    font-weight: 800;
    border-bottom: none;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 2px solid var(--border-light, #e5e7eb);
    color: var(--headings, #0f172a);
}

.bs-summary-final-price {
    color: var(--action-primary);
    font-size: 1.4rem;
}

/* Collapsible Coupon UI */
.bs-coupon-toggle-btn {
    background: none;
    border: none;
    color: var(--text-muted, #6b7280);
    font-size: 0.88rem;
    cursor: pointer;
    padding: 8px 0;
    text-decoration: underline;
}

.bs-coupon-toggle-btn:hover {
    color: var(--dark-text, #111827);
}

.bs-coupon-input-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.bs-input {
    background: var(--card-white, #ffffff);
    border: 1px solid var(--border-light, #e5e7eb);
    color: var(--dark-text, #111827);
    padding: 10px 14px;
    border-radius: 6px;
    width: 100%;
    font-size: 0.9rem;
}

.bs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--action-primary);
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.bs-btn:hover {
    opacity: 0.9;
}

.bs-btn-block {
    width: 100%;
}

/* Mobile Sticky Bottom CTA Bar */
.bs-mobile-sticky-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background: var(--card-white, #ffffff);
    border-top: 1px solid var(--border-light, #e5e7eb);
    padding: 12px 20px;
    display: none;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}

@media (max-width: 768px) {
    .bs-mobile-sticky-bar.bs-active {
        display: flex;
    }
}

/* History Tables & Mobile Cards */
.bs-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.bs-table th, .bs-table td {
    padding: 12px 16px;
    text-align: right;
    border-bottom: 1px solid var(--border-light, #e5e7eb);
}

.bs-table th {
    background: var(--inner-box-gray, #f3f4f6);
    color: var(--headings, #0f172a);
    font-weight: 600;
}

@media (max-width: 640px) {
    .bs-table, .bs-table tbody, .bs-table tr, .bs-table td, .bs-table th {
        display: block;
    }
    .bs-table thead {
        display: none;
    }
    .bs-table tr {
        background: var(--card-white, #ffffff);
        border: 1px solid var(--border-light, #e5e7eb);
        border-radius: 8px;
        margin-bottom: 12px;
        padding: 14px;
    }
    .bs-table td {
        border-bottom: none;
        padding: 6px 0;
        display: flex;
        justify-content: space-between;
    }
    .bs-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted, #6b7280);
    }
}
