/* =============================================================
   order-summary.css — 3Life Cart: order summary sidebar
   ============================================================= */

/* ── Sticky sidebar container ────────────────────────────────── */

.secondary-cart-sidebar {
    position: sticky;
    top: 20px;
    height: fit-content;
}

.order-summary-wrapper {
    background: var(--dominant-800);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

/* ── Summary heading ─────────────────────────────────────────── */

.order-summary {
    padding: 20px 20px 0;
}

.summary-heading {
    color: var(--dominant-50) !important;
    font-size: 1.05rem !important;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 16px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
}

/* ── Skeleton loader ─────────────────────────────────────────── */

@keyframes shimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.summary-skeleton {
    padding: 4px 0 20px;
}

.skeleton-line {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        var(--dominant-700) 0%,
        var(--dominant-600) 50%,
        var(--dominant-700) 100%
    );
    background-size: 800px 14px;
    animation: shimmer 1.5s infinite linear;
    margin-bottom: 10px;
}

.skeleton-line--wide   { width: 100%; }
.skeleton-line--medium { width: 70%; }
.skeleton-line--short  { width: 45%; }

.skeleton-divider {
    height: 1px;
    background: var(--border);
    margin: 14px 0;
}

.skeleton-line--total {
    height: 20px;
    width: 60%;
    border-radius: 4px;
    background: linear-gradient(
        90deg,
        var(--dominant-600) 0%,
        var(--dominant-500) 50%,
        var(--dominant-600) 100%
    );
    background-size: 800px 20px;
    animation: shimmer 1.5s infinite linear;
}

/* ── producttotal content injected by WHMCS recalctotals() ───── */

.summary-container {
    padding-bottom: 16px;
}

/* Product name in summary */
#producttotal .product-name,
#producttotal strong,
#producttotal .productName {
    color: var(--dominant-100);
    font-size: 0.9rem;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

/* Line items — config options, addons */
#producttotal table {
    width: 100%;
    border-collapse: collapse;
}

#producttotal table td {
    color: var(--dominant-200);
    font-size: 0.85rem;
    padding: 4px 0;
    vertical-align: top;
}

#producttotal table td:last-child {
    text-align: right;
    color: var(--dominant-100);
    white-space: nowrap;
}

/* Rows within standard_cart's injected table */
#producttotal .summary-items-table tr,
#producttotal .cart-items tr {
    border-bottom: 1px solid var(--border);
}

/* Subtotal row */
#producttotal .subtotal td,
#producttotal tr.subtotal td {
    color: var(--dominant-300);
    font-size: 0.85rem;
    padding: 6px 0;
    border-top: 1px solid var(--border);
}

/* Discount row */
#producttotal .discount td,
#producttotal tr.discount td,
#producttotal .promodiscount td {
    color: var(--success);
    font-size: 0.85rem;
    padding: 4px 0;
}

/* Total row */
#producttotal .total td,
#producttotal tr.total td,
#producttotal .totaldue td {
    color: var(--dominant-50);
    font-weight: 700;
    font-size: 1rem;
    padding: 8px 0 4px;
    border-top: 1px solid var(--border);
}

/* "Due Today" prominent display */
.total-due-today {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0 6px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.total-due-today .label {
    color: var(--dominant-300);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.total-due-today .amount {
    color: var(--dominant-50);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Recurring text */
#producttotal .recurring,
#producttotal .renewal,
#producttotal small {
    color: var(--dominant-400);
    font-size: 0.78rem;
    display: block;
    margin-top: 4px;
}

/* Standard_cart injects an h4 for product name in some themes */
#producttotal h4 {
    color: var(--dominant-100) !important;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 10px;
}

/* Promo badge / discount label */
#producttotal .discount-label,
#producttotal .promo-badge {
    background: rgba(92, 143, 90, 0.15);
    border: 1px solid rgba(92, 143, 90, 0.35);
    border-radius: 4px;
    color: var(--success);
    font-size: 0.75rem;
    padding: 2px 8px;
    display: inline-block;
    margin-left: 6px;
}

/* ── Continue / CTA button ───────────────────────────────────── */

.summary-cta {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.btn-continue {
    display: block;
    width: 100%;
    background: var(--accent-400);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    padding: 13px 20px;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
    text-align: center;
}

.btn-continue:hover {
    background: var(--accent-300);
}

.btn-continue:active {
    transform: scale(0.98);
}

.btn-continue i {
    margin-left: 8px;
    font-size: 0.9em;
}

/* ── Guarantee badge ─────────────────────────────────────────── */

.summary-guarantee {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    border-top: 1px solid var(--border);
    background: rgba(92, 143, 90, 0.06);
}

.summary-guarantee i {
    color: var(--success);
    font-size: 0.95rem;
}

.summary-guarantee span {
    color: var(--dominant-300);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ── Mobile: sidebar moves below the form ────────────────────── */

@media (max-width: 767px) {
    .secondary-cart-sidebar {
        position: static;
        margin-top: 24px;
    }
}

/* ── Design polish — matching marketing site ──────────────────── */

.order-summary-wrapper {
    box-shadow: 0 0 0 1px rgba(205, 97, 65, 0.08), 0 8px 30px rgba(0, 0, 0, 0.4);
}

.btn-continue:hover {
    box-shadow: 0 0 20px rgba(205, 97, 65, 0.35);
}

.summary-heading {
    border-bottom: none;
    border-image: linear-gradient(90deg, transparent, #CD6141, transparent) 1;
    border-bottom: 1px solid;
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; transform: none !important; animation: none !important; }
}

/* =============================================================
   Configure-product page: checkout-style sidebar overrides
   The sidebar on configureproduct.tpl uses .checkout-summary-card
   inside .secondary-cart-sidebar instead of .checkout-order-summary,
   so we re-anchor the sticky behaviour here.
   ============================================================= */

.secondary-cart-sidebar .checkout-sidebar-inner {
    position: sticky;
    top: 20px;
    width: 100%;
}

.secondary-cart-sidebar .checkout-summary-card {
    padding: 20px 22px;
    width: 100%;
    box-sizing: border-box;
}

/* Remove the bottom margin on the CTA button — guarantee badge
   provides enough breathing room */
.secondary-cart-sidebar .btn-complete-order {
    margin-bottom: 12px;
}

/* Totals wrapper on configure page — no top border needed because
   the skeleton/producttotal already have internal spacing */
.configure-product-totals {
    border-top: none;
    padding-top: 0;
    margin-bottom: 0;
}

/* Skeleton inside the checkout-style card */
.configure-summary-skeleton {
    padding: 12px 0 8px;
}

/* ── #producttotal: custom ordersummary.tpl output ──────────── */

.secondary-cart-sidebar #producttotal {
    padding: 0;
    transition: opacity 0.15s ease;
}

.secondary-cart-sidebar #producttotal:not(:empty) {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
}

/* Config options — clean inline list */
#producttotal .summary-item-options {
    padding-bottom: 10px;
}

#producttotal .summary-config-option {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted, #b0b0b0);
    line-height: 1.6;
}

/* Totals rows (subtotal, setup, tax) */
#producttotal .summary-totals {
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

#producttotal .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.9rem;
    color: var(--text-muted, #b0b0b0);
}

#producttotal .summary-row--discount span {
    color: var(--accent-green, #4ade80);
}

/* Total due today — uses .total-due-today/.amt for promo hook compat.
   flex-direction: row-reverse flips the DOM order (amt first, label second)
   so it renders as: label left, green price right. */
#producttotal .total-due-today {
    display: flex;
    flex-direction: row-reverse;
    justify-content: space-between;
    align-items: baseline;
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 12px;
}

#producttotal .total-due-today span:not(.amt) {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text, #e0e0e0);
}

#producttotal .total-due-today .amt {
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--accent-green, #4ade80);
}

/* Promo discount row injected by the hook */
#producttotal .promo-discount-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    font-size: 0.9rem;
}

/* Promo renews row injected by the hook */
#producttotal .promo-renews-row {
    text-align: center;
    font-size: 0.8rem;
    padding: 8px 0 2px;
    color: var(--text-muted, #8e8e8e);
}

/* Renewal line — override checkout.css flex-column layout for single-line display */
#producttotal .summary-recurring {
    display: block;
    flex-direction: unset;
    gap: unset;
    font-size: 0.78rem;
    color: var(--dominant-400, #616161);
    margin-top: 6px;
    margin-bottom: 0;
    padding-top: 2px;
    white-space: nowrap;
}

#producttotal .summary-recurring i {
    font-size: 0.65rem;
    color: var(--dominant-500, #4b4b4b);
    margin-right: 3px;
}

#producttotal .summary-recurring .cost {
    display: inline;
    color: var(--dominant-200, #bbbbbb);
    font-weight: 600;
}

/* Promo badge — green pill matching checkout */
#producttotal .summary-promo {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.25);
    border-radius: 6px;
    padding: 8px 12px;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

#producttotal .summary-promo .promo-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(76, 175, 80, 0.25);
    color: #4ade80;
    font-weight: 700;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
}

#producttotal .summary-promo .promo-badge .fas {
    font-size: 0.65rem;
}

#producttotal .summary-promo .promo-desc {
    color: var(--text, #e0e0e0);
    font-size: 0.8rem;
}

@media (max-width: 991px) {
    .secondary-cart-sidebar {
        position: static;
        margin-top: 24px;
    }
    .secondary-cart-sidebar .checkout-sidebar-inner {
        position: static;
    }
}
