/* ============================================================
   Attorney Credits – Mini-Cart Widget  (aci-cart.css)
   ============================================================ */

/* ── Cart trigger (icon + badge) ───────────────────────────── */
.aci-cart {
    position: relative;
    display: inline-flex;
    align-items: center;
}
.aci-cart[hidden] {
    display: none !important;
}

.aci-cart__trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: inherit;
    transition: opacity .15s;
    line-height: 1;
}
.aci-cart__trigger:hover { opacity: .75; }

.aci-cart__trigger svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: block;
}

.aci-cart__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 4px;
    background: #e53e3e;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    border-radius: 9px;
    text-align: center;
    pointer-events: none;
    box-sizing: border-box;
}

/* ── Dropdown panel ────────────────────────────────────────── */
.aci-cart__dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    /* Wider on desktop so item type + name + remove all fit without truncation.
       min() keeps it from overflowing the viewport edge on small screens. */
    width: min(420px, calc(100vw - 16px));
    background: #fff;
    color: #1a202c;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06);
    z-index: 9999;
    font-size: .9rem;
    overflow: hidden;
}

/* Dark-theme awareness */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aci-cart__dropdown {
        background: #1e293b;
        color: #f1f5f9;
        border-color: #334155;
        box-shadow: 0 8px 32px rgba(0,0,0,.4);
    }
}
:root[data-theme="dark"] .aci-cart__dropdown {
    background: #1e293b;
    color: #f1f5f9;
    border-color: #334155;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

.aci-cart__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 700;
    font-size: .95rem;
}
:root[data-theme="dark"] .aci-cart__header,
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aci-cart__header { border-color: #334155; }
}

.aci-cart__close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 1.2rem;
    line-height: 1;
    color: inherit;
    opacity: .5;
    transition: opacity .15s;
    border-radius: 4px;
}
.aci-cart__close-btn:hover { opacity: 1; }

/* ── Item list ─────────────────────────────────────────────── */
.aci-cart__list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.aci-cart__item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
}
:root[data-theme="dark"] .aci-cart__item { border-color: #2d3748; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aci-cart__item { border-color: #2d3748; }
}

.aci-cart__item:last-child { border-bottom: none; }

.aci-cart__item-type {
    /* Fixed column width — wide enough for the longest label ("UNLIMITED").
       All rows align because every badge occupies the same space. */
    flex-shrink: 0;
    width: 76px;
    text-align: center;
    align-self: flex-start;
    white-space: nowrap;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: .6rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    background: #ebf4ff;
    color: #2563eb;
    margin-top: 2px;
    box-sizing: border-box;
}
.aci-cart__item-type--bundle {
    background: #f0fdf4;
    color: #16a34a;
}
.aci-cart__item-type--unlimited {
    background: #fdf4ff;
    color: #9333ea;
}
.aci-cart__item-type--webinar {
    background: #fff7ed;
    color: #ea580c;
}

.aci-cart__item-body {
    flex: 1;
    min-width: 0;
}

.aci-cart__item-name {
    font-weight: 600;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aci-cart__item-link {
    color: inherit;
    text-decoration: none;
}
.aci-cart__item-link:hover {
    text-decoration: underline;
    opacity: .85;
}

.aci-cart__item-meta {
    font-size: .78rem;
    opacity: .65;
    margin-top: 2px;
}

.aci-cart__item-remove {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 4px;
    font-size: 1rem;
    line-height: 1;
    opacity: .35;
    color: inherit;
    transition: opacity .15s;
    border-radius: 4px;
    margin-top: 2px;
}
.aci-cart__item-remove:hover { opacity: .9; }

/* ── Empty state ───────────────────────────────────────────── */
.aci-cart__empty {
    padding: 28px 16px;
    text-align: center;
    opacity: .5;
    font-size: .88rem;
}

/* ── Footer / checkout ─────────────────────────────────────── */
.aci-cart__footer {
    padding: 12px 16px;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
:root[data-theme="dark"] .aci-cart__footer { border-color: #334155; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .aci-cart__footer { border-color: #334155; }
}

.aci-cart__total {
    font-size: .85rem;
    font-weight: 600;
    text-align: right;
    opacity: .7;
}

.aci-cart__checkout-btn {
    display: block;
    width: 100%;
    padding: 11px 16px;
    background: #2563eb;
    color: #fff !important;
    border: none;
    border-radius: 7px;
    font-size: .92rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    box-sizing: border-box;
}
.aci-cart__checkout-btn:hover { background: #1d4ed8; color: #fff !important; }
.aci-cart__checkout-btn:disabled,
.aci-cart__checkout-btn.is-loading {
    opacity: .6;
    cursor: default;
}

.aci-cart__clear-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: .78rem;
    cursor: pointer;
    text-decoration: underline;
    text-align: center;
    padding: 0;
    transition: color .15s;
}
.aci-cart__clear-btn:hover { color: #e53e3e; }

/* ── "Add to cart" buttons (global) ───────────────────────── */
.aci-add-to-cart {
    cursor: pointer;
    transition: opacity .15s, background .15s;
}
.aci-add-to-cart.is-adding { opacity: .6; cursor: default; pointer-events: none; }
.aci-add-to-cart.is-added  { pointer-events: none; }

/* Course row cart button  */
.ac-course-row__cart-btn.aci-add-to-cart {
    display: inline-block;
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: .84rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}
.ac-course-row__cart-btn.aci-add-to-cart:hover { background: #1d4ed8; }
.ac-course-row__cart-btn.aci-add-to-cart.is-added { background: #16a34a; }

/* Course detail buy button  */
.ac-course-buy-btn.aci-add-to-cart {
    display: inline-block;
    padding: 12px 24px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
    transition: background .15s, opacity .15s;
}
.ac-course-buy-btn.aci-add-to-cart:hover { background: #1d4ed8; }
.ac-course-buy-btn.aci-add-to-cart.is-added { background: #16a34a; }

/* Bundle buy button  */
.acbb-buy-btn.aci-add-to-cart {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 15px 24px;
    background: #2563eb;
    color: #fff !important;
    border: 2px solid #2563eb;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    text-decoration: none;
    box-sizing: border-box;
    text-align: center;
    cursor: pointer;
    transition: opacity .15s;
}
.acbb-buy-btn.aci-add-to-cart:hover { opacity: .88; }
.acbb-buy-btn.aci-add-to-cart.is-added { background: #16a34a; border-color: #16a34a; }

/* Bundle card grid button  */
.ac-bundle-card__btn.aci-add-to-cart { cursor: pointer; }
.ac-bundle-card__btn.aci-add-to-cart.is-added { background: #16a34a !important; border-color: #16a34a !important; }

/* State-all-courses table buy button */
.ac-course-table__buy-btn {
    display: inline-block;
    padding: 6px 14px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    transition: background .15s, opacity .15s;
}
.ac-course-table__buy-btn:hover { background: #1d4ed8; }
.ac-course-table__buy-btn.aci-add-to-cart.is-added { background: #16a34a; }

/* ── Toast notification ────────────────────────────────────── */
.aci-cart-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1e293b;
    color: #f8fafc;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: .88rem;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    z-index: 99999;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .25s, transform .25s;
    pointer-events: none;
    max-width: 300px;
}
.aci-cart-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}
.aci-cart-toast--success { border-left: 4px solid #16a34a; }
.aci-cart-toast--error   { border-left: 4px solid #e53e3e; }
