/**
 * Advanced Subscription Manager - Frontend Styles
 * @version 1.1.0
 */

/* Subscription Options Container */
.asm-subscription-options {
    --asm-accent: #58bfac; /* teal from the design */
    --asm-accent-dark: #43a795;
    --asm-border: #ececec;
    --asm-muted: #9aa0a6;
    margin: 24px 0;
    padding: 22px 24px 26px;
    background: #fff;
    border: 1px solid var(--asm-border);
    border-radius: 14px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.04);
    font-family: inherit;
}

.asm-subscription-options .asm-title {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
    color: var(--asm-accent);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .2px;
}

/* ---- Segmented pill toggle (One time | Subscribe & Save) ---- */
.asm-purchase-toggle {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.asm-toggle-option {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
    padding: 14px 18px;
    min-height: 52px;
    background: #fff;
    border: 1.5px solid var(--asm-border);
    border-radius: 999px;
    color: var(--asm-muted);
    font-size: 15px;
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: background .2s ease, border-color .2s ease, color .2s ease, box-shadow .2s ease;
    -webkit-user-select: none;
    user-select: none;
}

/* Hide the native radio; the whole pill is the control */
.asm-toggle-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    margin: 0;
    pointer-events: none;
}

.asm-toggle-option:hover {
    border-color: var(--asm-accent);
    color: var(--asm-accent-dark);
}

/* Active pill = filled teal */
.asm-toggle-option.is-active {
    background: var(--asm-accent);
    border-color: var(--asm-accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(88, 191, 172, 0.35);
}

.asm-toggle-option.is-active:hover {
    color: #fff;
}

/* Keyboard focus ring for accessibility */
.asm-toggle-option input[type="radio"]:focus-visible + .asm-toggle-label {
    outline: 2px solid var(--asm-accent-dark);
    outline-offset: 3px;
    border-radius: 4px;
}

.asm-toggle-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.6;
}

.asm-toggle-option:not(.is-active) .asm-toggle-badge {
    background: #eafaf6;
    color: var(--asm-accent-dark);
}

/* ---- Subscription plan choices (revealed on "Subscribe & Save") ---- */
.asm-plans {
    margin-top: 18px;
    display: grid;
    gap: 10px;
    animation: asm-fade-in .25s ease;
}

.asm-plans[hidden] {
    display: none;
}

.asm-plan {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0;
    padding: 14px 16px;
    background: #fff;
    border: 1.5px solid var(--asm-border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}

.asm-plan:hover {
    border-color: var(--asm-accent);
    background: #f7fdfb;
}

.asm-plan input[type="radio"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--asm-accent);
    cursor: pointer;
    flex: 0 0 auto;
}

.asm-plan:has(input[type="radio"]:checked) {
    border-color: var(--asm-accent);
    background: #eafaf6;
    box-shadow: 0 2px 10px rgba(88, 191, 172, 0.18);
}

.asm-plan-label {
    flex: 1 1 auto;
    font-size: 15px;
    font-weight: 500;
    color: #2b2f33;
}

.asm-plan-extra {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--asm-accent-dark);
}

/* Green "% OFF" Discount Badge (matches reference design) */
.asm-discount-badge {
    display: inline-block;
    padding: 4px 10px;
    background: #00a32a;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border-radius: 4px;
    white-space: nowrap;
}

/* ---- Special offer ---- */
.asm-special-offer {
    margin-top: 16px;
    padding: 12px 14px;
    background: #fffdf3;
    border: 1px solid #f4e6b8;
    border-radius: 10px;
    font-size: 14px;
}

.asm-special-offer p {
    margin: 0;
}

/* ---- Subscription Benefits (injected by JS) ---- */
.asm-benefits {
    margin-top: 16px;
    padding: 14px 16px;
    background: #f7fdfb;
    border: 1px solid #d9f2ea;
    border-radius: 10px;
}

.asm-benefits h5 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--asm-accent-dark);
}

.asm-benefits ul {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.asm-benefits li {
    margin: 6px 0;
    padding-left: 24px;
    position: relative;
    font-size: 14px;
    color: #4a4f54;
}

.asm-benefits li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--asm-accent);
    font-weight: bold;
    font-size: 15px;
}

/* Price Display */
.asm-price-info {
    margin-top: 14px;
    padding: 12px 16px;
    background: #eafaf6;
    border-radius: 10px;
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
}

.asm-price-info .discounted-price {
    color: var(--asm-accent-dark);
    font-weight: 700;
    font-size: 20px;
    line-height: 1.2;
}

.asm-price-info .original-price {
    text-decoration: line-through;
    color: var(--asm-muted);
    font-size: 15px;
}

.asm-price-info .asm-discount-badge {
    margin-left: auto;
    background: #00a32a;
}

/* Loading Spinner */
.asm-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--asm-accent);
    border-radius: 50%;
    animation: asm-spin 1s linear infinite;
}

@keyframes asm-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

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

/* Responsive Design */
@media (max-width: 600px) {
    .asm-subscription-options {
        padding: 18px 16px 20px;
    }

    .asm-purchase-toggle {
        flex-direction: column;
        gap: 10px;
    }

    .asm-toggle-option {
        min-height: 48px;
        font-size: 14px;
    }
}
