/**
 * Cocoa Runners Subscription Actions - Frontend Styles
 *
 * Scoped to .crsa-* classes. Brand colour: #1d1d1b.
 */

/* ───── Container ───── */

.crsa-container {
    padding: 16px 0;
}

.crsa-container.crsa-locked {
    opacity: 0.6;
    pointer-events: none;
}

.crsa-lockout-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #856404;
}

.crsa-lockout-notice p {
    margin: 0;
}

/* ───── Actions Bar ───── */

.crsa-actions-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* ───── Buttons ─────
 *
 * The theme's button reset uses :not(#mobile-search) which gives it ID-level
 * specificity (1,5,1). No combination of class selectors can beat that, so we
 * use !important on the visual properties the theme overrides (background,
 * border, color, padding, appearance). This is applied to every button state
 * to prevent the theme leaking through on variants or hover.
 */

.crsa-actions-bar .crsa-btn,
.crsa-dialog .crsa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px !important;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid #1d1d1b !important;
    background: #1d1d1b !important;
    color: #fff !important;
    border-radius: 0;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, opacity 0.2s;
    font-family: inherit;
    text-decoration: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.crsa-actions-bar .crsa-btn:disabled,
.crsa-dialog .crsa-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.crsa-actions-bar .crsa-btn-primary,
.crsa-dialog .crsa-btn-primary {
    background: #1d1d1b !important;
    color: #fff !important;
    border-color: #1d1d1b !important;
}

.crsa-actions-bar .crsa-btn-primary:hover:not(:disabled),
.crsa-dialog .crsa-btn-primary:hover:not(:disabled) {
    background: #fff !important;
    border-color: #1d1d1b !important;
    color: #1d1d1b !important;
}

.crsa-actions-bar .crsa-btn-secondary,
.crsa-dialog .crsa-btn-secondary {
    background: #fff !important;
    color: #1d1d1b !important;
    border-color: #ccc !important;
}

.crsa-actions-bar .crsa-btn-secondary:hover:not(:disabled),
.crsa-dialog .crsa-btn-secondary:hover:not(:disabled) {
    background: #f5f5f5 !important;
    border-color: #999 !important;
    color: #1d1d1b !important;
}

.crsa-actions-bar .crsa-btn-danger,
.crsa-dialog .crsa-btn-danger {
    background: #dc3545 !important;
    color: #fff !important;
    border-color: #dc3545 !important;
}

.crsa-actions-bar .crsa-btn-danger:hover:not(:disabled),
.crsa-dialog .crsa-btn-danger:hover:not(:disabled) {
    background: #c82333 !important;
    border-color: #bd2130 !important;
    color: #fff !important;
}

/* ───── Dropdown ───── */

.crsa-dropdown {
    position: relative;
    display: inline-block;
}

.crsa-caret {
    font-size: 10px;
    margin-left: 2px;
}

.crsa-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 220px;
    margin: 4px 0 0;
    padding: 4px 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    list-style: none;
}

.crsa-dropdown-menu.crsa-dropdown-open {
    display: block;
}

.crsa-dropdown-menu li {
    margin: 0;
    list-style: none;
}

.crsa-actions-bar .crsa-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px !important;
    font-size: 14px;
    font-family: inherit;
    text-align: left;
    background: none !important;
    border: none !important;
    cursor: pointer;
    color: #1d1d1b !important;
    text-decoration: none !important;
}

.crsa-actions-bar .crsa-dropdown-menu button:hover {
    background: #f5f5f5 !important;
}

.crsa-dropdown-divider {
    height: 0;
    margin: 4px 0;
    border-top: 1px solid #eee;
}

.crsa-actions-bar .crsa-dropdown-menu button.crsa-text-danger {
    color: #dc3545 !important;
}

/* ───── Dialog ───── */

.crsa-dialog {
    border: none;
    border-radius: 8px;
    padding: 0;
    max-width: 520px;
    width: calc(100% - 32px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.crsa-dialog::backdrop {
    background: rgba(0, 0, 0, 0.5);
}

.crsa-dialog-content {
    padding: 0;
}

.crsa-dialog-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #eee;
}

.crsa-dialog-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1d1d1b;
}

.crsa-dialog .crsa-dialog-cancel {
    cursor: pointer;
}

.crsa-dialog .crsa-dialog-close {
    background: none !important;
    border: none !important;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #999 !important;
    padding: 0 !important;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.crsa-dialog .crsa-dialog-close:hover {
    color: #333 !important;
    background: #f5f5f5 !important;
}

.crsa-dialog-body {
    padding: 20px 24px;
}

.crsa-dialog-body p {
    margin: 0 0 12px;
    font-size: 14px;
    line-height: 1.5;
    color: #444;
}

.crsa-dialog-body p:last-child {
    margin-bottom: 0;
}

.crsa-dialog-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #eee;
}

/* ───── Radio Options ───── */

.crsa-radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin: 6px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.crsa-radio-option:hover {
    border-color: #999;
    background-color: #fafafa;
}

.crsa-radio-option.crsa-radio-selected {
    border-color: #1d1d1b;
    background-color: #f9f9f7;
}

.crsa-radio-option input[type="radio"] {
    margin: 0;
    accent-color: #1d1d1b;
}

.crsa-radio-option span {
    font-size: 14px;
    color: #1d1d1b;
}

/* ───── Form Fields ───── */

.crsa-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.crsa-form-field {
    margin-bottom: 14px;
}

.crsa-form-field label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 500;
    color: #333;
}

.crsa-form-field label .required {
    color: #dc3545;
}

.crsa-form-field input[type="text"],
.crsa-form-field select,
.crsa-form-field textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 14px;
    font-family: inherit;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.crsa-form-field input:focus,
.crsa-form-field select:focus,
.crsa-form-field textarea:focus {
    outline: none;
    border-color: #1d1d1b;
}

.crsa-form-field textarea {
    resize: vertical;
}

/* ───── Notice ───── */

.crsa-notice-info {
    background: #e8f4fd;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 10px 14px;
    color: #0c5460;
    font-size: 13px;
}

.crsa-text-muted {
    color: #999 !important;
    font-size: 13px !important;
}

/* ───── Toast Notifications ───── */

.crsa-toast {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10001;
    max-width: 400px;
    padding: 14px 20px;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.4;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transform: translateX(120%);
    transition: transform 0.3s ease;
}

.crsa-toast-visible {
    transform: translateX(0);
}

.crsa-toast-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.crsa-toast-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* ───── Responsive ───── */

@media (max-width: 480px) {
    .crsa-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .crsa-actions-bar .crsa-btn {
        justify-content: center;
    }

    .crsa-dropdown-menu {
        left: 0;
        right: 0;
        min-width: 0;
    }

    .crsa-dialog {
        max-width: none;
        width: calc(100% - 16px);
        margin: 8px;
    }

    .crsa-form-row {
        grid-template-columns: 1fr;
    }

    .crsa-dialog-footer {
        flex-direction: column-reverse;
    }

    .crsa-dialog .crsa-dialog-footer .crsa-btn {
        width: 100%;
        justify-content: center;
    }
}
/* ───── Club benefits (My Account > Subscriptions list) ─────
 *
 * Sized against the account content column (not the viewport) via a container
 * query, since that column sits beside the account nav on desktop.
 */

.crsa-benefits {
    container-type: inline-size;
    margin-bottom: 40px;
}

.crsa-benefits__title {
    margin: 0 0 8px;
}

.crsa-benefits__intro {
    margin: 0 0 24px;
    color: #5f5e5a;
}

.crsa-benefits__featured,
.crsa-benefits__perks {
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr;
}

.crsa-benefits__featured {
    margin-bottom: 12px;
}

@container (min-width: 420px) {
    .crsa-benefits__perks {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container (min-width: 600px) {
    .crsa-benefits__featured {
        grid-template-columns: repeat(2, 1fr);
    }
}

@container (min-width: 820px) {
    .crsa-benefits__perks {
        grid-template-columns: repeat(4, 1fr);
    }
}

.crsa-benefit {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 20px;
    border-radius: 10px;
    background: #f0efeb;
    color: #1d1d1b;
}

.crsa-benefit--featured {
    padding: 32px 24px;
    background: #d9d6cf;
}

.crsa-benefit__icon {
    flex-shrink: 0;
    margin-bottom: 12px;
}

/* Wulkan only ships Regular/Light — keep weight 400 to avoid faux-bold. */
.crsa-benefit__title {
    margin: 0 0 8px;
    padding: 0;
    font-family: "Wulkan Display Regular", serif;
    font-weight: 400;
    font-size: 1.25rem;
    line-height: 1.2;
}

.crsa-benefit--featured .crsa-benefit__title {
    font-size: 1.75rem;
}

/* `.crsa-benefit p` beats the theme's paragraph padding-bottom. */
.crsa-benefit p {
    padding: 0;
}

.crsa-benefit__text {
    margin: 0 0 20px;
    font-size: 0.9375rem;
    line-height: 1.45;
}

.crsa-benefit__text:last-child {
    margin-bottom: 0;
}

/* margin-top:auto pins pills to the bottom so they align across featured cards.
 * (0,3,1) beats the theme's `p:last-child:not(.alert)` (0,2,1), which zeroes padding
 * and loads after this file, so a tie would go to the theme. */
.crsa-benefits .crsa-benefit p.crsa-benefit__pill {
    margin: auto 0 0;
    padding: 10px 18px;
    border-radius: 6px;
    background: #fff;
    font-size: 0.9375rem;
    line-height: 1.3;
}

/* ───── Address quote + cancel suggestions ───── */

/* `display: flex` on footers would otherwise beat the hidden attribute. */
.crsa-dialog [hidden] {
    display: none !important;
}

.crsa-quote-table {
    width: 100%;
    margin: 12px 0;
    border-collapse: collapse;
    font-size: 14px;
}

.crsa-quote-table th,
.crsa-quote-table td {
    padding: 8px 6px;
    border-bottom: 1px solid #e5e5e5;
    text-align: right;
}

.crsa-quote-table th[scope="row"],
.crsa-quote-table thead th:first-child {
    text-align: left;
}

.crsa-quote-table td:last-child {
    font-weight: 600;
}

.crsa-cancel-suggestion {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 4px;
    background: #f0efeb;
}

.crsa-cancel-suggestion p {
    margin: 0 0 10px;
    padding: 0;
}
