.purchase {
    background: #f8f9fb;
    min-height: calc(100vh - 86px);
    padding: 32px 24px 64px;
}

.purchase-content {
    max-width: 960px;
    margin: 0 auto;
}

.package-selector {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 16px 20px 18px;
    margin-bottom: 28px;
}

.package-name {
    font-size: 18px;
    font-weight: 600;
    color: #111;
    margin-bottom: 12px;
}

.module-options {
    display: flex;
    gap: 36px;
    flex-wrap: wrap;
}

    .module-options label {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 14px;
        color: #333;
        cursor: pointer;
    }

    .module-options input[type="checkbox"] {
        width: 18px;
        height: 18px;
        accent-color: #1f66d1;
        cursor: pointer;
    }

.section {
    margin-bottom: 28px;
}

.section-label {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    margin-bottom: 12px;
}

.plan-grid,
.duration-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.plan-card {
    position: relative;
    display: block;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.1s, background 0.1s;
}

    .plan-card:has(input:checked) {
        border-color: #1f66d1;
        background: #f0f4ff;
        box-shadow: inset 0 0 0 1px #1f66d1;
    }

    .plan-card input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.plan-title {
    font-weight: 600;
    font-size: 15px;
    color: #111;
}

.plan-desc {
    font-size: 13px;
    color: #666;
    margin-top: 4px;
    line-height: 1.4;
}

.duration-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 10px 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.1s, background 0.1s;
}

    .duration-card:has(input:checked) {
        border-color: #1f66d1;
        background: #f0f4ff;
        box-shadow: inset 0 0 0 1px #1f66d1;
    }

    .duration-card input {
        position: absolute;
        opacity: 0;
        pointer-events: none;
    }

.dur-label {
    font-size: 14px;
    color: #222;
}

.dur-price {
    font-size: 14px;
    font-weight: 600;
    color: #1f66d1;
}

.order-summary {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px 18px 14px;
    background: #fff;
}

.summary-title {
    font-size: 13px;
    color: #888;
    margin-bottom: 6px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    padding: 3px 0;
    color: #222;
}

    .summary-row.total {
        font-weight: 600;
        margin-top: 2px;
    }

.summary-divider {
    height: 1px;
    background: #eee;
    margin: 8px 0 6px;
}

.total-price {
    color: #1f66d1;
    font-size: 18px;
    font-weight: 700;
}

.terms {
    text-align: center;
    margin: 18px 0 12px;
    font-size: 14px;
    color: #333;
}

    .terms label {
        cursor: pointer;
        display: inline-flex;
        align-items: center;
        gap: 6px;
    }

    .terms input {
        accent-color: #1f66d1;
    }

.submit-btn {
    display: block;
    margin: 0 auto;
    padding: 10px 64px;
    background: #1f66d1;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.15s;
}

    .submit-btn:hover:not(:disabled) {
        background: #1653b0;
    }

    .submit-btn:disabled {
        background: #aaa;
        color: #f0f0f0;
        cursor: not-allowed;
    }

.success {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

    .success h2 {
        margin: 0 0 12px;
        font-size: 22px;
        color: #1f66d1;
    }

    .success p {
        margin: 0 0 24px;
        color: #555;
        line-height: 1.7;
    }

@media (max-width: 720px) {
    .plan-grid,
    .duration-grid {
        grid-template-columns: 1fr;
    }

    .module-options {
        gap: 16px 24px;
    }
}

/* ===== New purchase UI styles for the redesigned flow ===== */

.module-pills {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.module-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #1f66d1;
    border-radius: 6px;
    border-radius: 6px;
    padding: 10px 15px;
    background: #fff;
    font-size: 14px;
    color: #1f66d1;
    cursor: pointer;
    user-select: none;
}

    .module-pill input[type="checkbox"] {
        width: 16px;
        height: 16px;
        accent-color: #1f66d1;
        margin: 0;
    }

    .module-pill:has(input:not(:checked)) {
        border-color: #ccc;
        color: #333;
        background: #fff;
    }

.user-counts {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.user-field label {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 6px;
}

.user-field input[type="number"] {
    width: 100%;
    padding: 10px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
}

.quota-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    background: #fff;
}

    .quota-table th,
    .quota-table td {
        border: 1px solid #e8e8e8;
        padding: 10px 8px;
        text-align: center;
        color: #222;
    }

    .quota-table th {
        background: #f7f8fa;
        font-weight: 500;
        color: #555;
        font-size: 12px;
    }

.time-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.account-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.order-detail {
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    background: #fff;
    padding: 14px 18px;
    line-height: 2;
}

.detail-title {
    font-size: 13px;
    color: #888;
    margin-bottom: 8px;
}

.pd-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    padding: 3px 0;
    color: #222;
}

    .pd-row.total {
        font-weight: 600;
        margin-top: 4px;
        padding-top: 6px;
        border-top: 1px solid #f0f0f0;
    }

    .pd-row .total-price {
        color: #1f66d1;
        font-size: 16px;
        font-weight: 700;
    }

@media (max-width: 640px) {
    .time-grid {
        grid-template-columns: 1fr;
    }

    .user-counts {
        gap: 20px;
    }
}

/* ===== Alert / validation modal (modeled after order-confirm.html) ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.modal-box {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    border-radius: 8px;
    padding: 24px 28px;
    width: 320px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

    .modal-box p {
        margin: 0 0 20px;
        font-size: 15px;
        color: #222;
    }

.modal-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
}

    .modal-actions button {
        padding: 8px 24px;
        border-radius: 4px;
        font-size: 14px;
        cursor: pointer;
        border: 1px solid #ddd;
    }

#alert-ok {
    background: #1f66d1;
    color: #fff;
    border-color: #1f66d1;
    padding: 8px 32px;
}

    #alert-ok:hover {
        background: #1653b0;
        border-color: #1653b0;
    }
