/* ============================================================
   LawnGurus Pop-up Cart
   ============================================================ */

:root {
    --lg-green-deep: #132e1b;
    --lg-green: #5a8f3e;
    --lg-green-light: #87b56b;
    --lg-cream: #f4f7ee;
    --lg-white: #ffffff;
    --lg-text: #2a3b2e;
    --lg-muted: #6b7a6e;
    --lg-border: #e3ead8;
    --lg-accent: #d94545;
    --lg-shadow: 0 20px 60px rgba(19, 46, 27, 0.18);
    --lg-shadow-sm: 0 4px 14px rgba(19, 46, 27, 0.18);
}

/* ----- Floating trigger button ----- */
.lg-cart-trigger {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 999998;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--lg-green);
    color: var(--lg-white);
    border: 3px solid var(--lg-white);
    box-shadow: var(--lg-shadow-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .25s ease, background .25s ease, box-shadow .25s ease;
    padding: 0;
    font-family: inherit;
}
.lg-cart-trigger:hover,
.lg-cart-trigger:focus-visible {
    background: var(--lg-green-deep);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 22px rgba(19, 46, 27, 0.28);
    outline: none;
}
.lg-cart-trigger:active { transform: translateY(0) scale(0.98); }
.lg-cart-icon { width: 26px; height: 26px; }

/* Item count badge */
.lg-cart-count {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: var(--lg-accent);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    border: 2px solid var(--lg-white);
    box-sizing: content-box;
    transform: scale(0);
    transition: transform .3s cubic-bezier(.34, 1.56, .64, 1);
}
.lg-cart-count.has-items { transform: scale(1); }
.lg-cart-count.bump { animation: lg-bump .4s ease; }
@keyframes lg-bump {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

/* ----- Backdrop ----- */
.lg-cart-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(19, 46, 27, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999998;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.lg-cart-backdrop.is-open { opacity: 1; visibility: visible; }

/* ----- Drawer ----- */
.lg-cart-drawer {
    position: fixed;
    top: 0;
    right: 0;
    width: 440px;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: var(--lg-white);
    z-index: 999999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.4, 0, .2, 1);
    box-shadow: var(--lg-shadow);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Nunito", sans-serif;
    color: var(--lg-text);
}
.lg-cart-drawer.is-open { transform: translateX(0); }

/* Header */
.lg-cart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
    background: var(--lg-green-deep);
    color: var(--lg-white);
    flex-shrink: 0;
}
.lg-cart-title {
    font-size: 22px;
    font-weight: 600;
    margin: 0;
    line-height: 1.2;
    color: var(--lg-white);
}
.lg-cart-subtitle {
    font-size: 13px;
    opacity: 0.75;
    display: block;
    margin-top: 2px;
}
.lg-cart-close {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: none;
    color: var(--lg-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .2s ease;
    padding: 0;
}
.lg-cart-close:hover { background: rgba(255,255,255,0.22); transform: rotate(90deg); }
.lg-cart-close svg { width: 20px; height: 20px; }

/* Body */
.lg-cart-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    -webkit-overflow-scrolling: touch;
}
.lg-cart-body::-webkit-scrollbar { width: 6px; }
.lg-cart-body::-webkit-scrollbar-thumb { background: var(--lg-border); border-radius: 3px; }

.lg-cart-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--lg-muted);
    font-size: 14px;
}

/* Empty state */
.lg-cart-empty {
    text-align: center;
    padding: 60px 20px 40px;
}
.lg-cart-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: var(--lg-cream);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--lg-green);
}
.lg-cart-empty-icon svg { width: 38px; height: 38px; }
.lg-cart-empty h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px;
    color: var(--lg-green-deep);
}
.lg-cart-empty p {
    color: var(--lg-muted);
    font-size: 14px;
    margin: 0 0 24px;
}
.lg-cart-empty-btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--lg-green);
    color: var(--lg-white) !important;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: background .2s ease;
}
.lg-cart-empty-btn:hover { background: var(--lg-green-deep); color: var(--lg-white) !important; }

/* Cart items */
.lg-cart-items { list-style: none; margin: 0; padding: 0; }
.lg-cart-item {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 14px;
    padding: 16px 0;
    border-bottom: 1px solid var(--lg-border);
    align-items: center;
    transition: opacity .2s ease;
}
.lg-cart-item:last-child { border-bottom: none; }
.lg-cart-item-image {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--lg-cream);
    flex-shrink: 0;
}
.lg-cart-item-image img {
    width: 100%; height: 100%; object-fit: cover; display: block;
}
.lg-cart-item-info { min-width: 0; }
.lg-cart-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--lg-green-deep);
    margin: 0 0 4px;
    line-height: 1.3;
    text-decoration: none;
    display: block;
}
.lg-cart-item-name:hover { color: var(--lg-green); }
.lg-cart-item-meta {
    font-size: 12px;
    color: var(--lg-muted);
    margin: 0 0 8px;
}
.lg-cart-item-price {
    font-size: 14px;
    font-weight: 600;
    color: var(--lg-green);
}
.lg-cart-item-price .woocommerce-Price-amount { color: inherit; }
.lg-cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

/* Quantity stepper */
.lg-qty {
    display: inline-flex;
    align-items: center;
    background: var(--lg-cream);
    border-radius: 999px;
    padding: 4px;
}
.lg-qty button {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: var(--lg-white);
    color: var(--lg-green-deep);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
    padding: 0;
    line-height: 1;
    font-family: inherit;
}
.lg-qty button:hover { background: var(--lg-green); color: var(--lg-white); }
.lg-qty button:disabled { opacity: 0.4; cursor: not-allowed; }
.lg-qty-value {
    min-width: 32px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--lg-text);
}

.lg-cart-remove {
    background: none;
    border: none;
    color: var(--lg-muted);
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color .2s ease;
    font-family: inherit;
}
.lg-cart-remove:hover { color: var(--lg-accent); }

/* Footer */
.lg-cart-footer {
    padding: 20px 24px 24px;
    border-top: 1px solid var(--lg-border);
    background: var(--lg-cream);
    flex-shrink: 0;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.lg-cart-totals {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}
.lg-cart-totals-label {
    font-size: 14px;
    color: var(--lg-muted);
    font-weight: 500;
}
.lg-cart-totals-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--lg-green-deep);
}
.lg-cart-totals-value .woocommerce-Price-amount { color: inherit; font-weight: inherit; }
.lg-cart-shipping-note {
    font-size: 12px;
    color: var(--lg-muted);
    margin: 0 0 16px;
    text-align: right;
}
.lg-cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}
.lg-cart-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 18px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all .2s ease;
    text-align: center;
    line-height: 1.2;
    border: 2px solid transparent;
    cursor: pointer;
    font-family: inherit;
}
.lg-cart-btn-secondary {
    background: var(--lg-white);
    color: var(--lg-green-deep) !important;
    border-color: var(--lg-green-deep);
}
.lg-cart-btn-secondary:hover {
    background: var(--lg-green-deep);
    color: var(--lg-white) !important;
}
.lg-cart-btn-primary {
    background: var(--lg-green-deep);
    color: var(--lg-white) !important;
}
.lg-cart-btn-primary:hover {
    background: var(--lg-green);
    color: var(--lg-white) !important;
}

/* Body scroll lock */
body.lg-cart-open { overflow: hidden; }

/* ----- Add-to-cart button feedback (single product pages) ----- */
button.lg-loading,
.single_add_to_cart_button.lg-loading {
    opacity: 0.75;
    cursor: progress !important;
    position: relative;
}
button.lg-added,
.single_add_to_cart_button.lg-added {
    background: var(--lg-green) !important;
    color: #fff !important;
    transition: background .2s ease;
}

/* Respect reduced-motion users */
@media (prefers-reduced-motion: reduce) {
    .lg-cart-drawer,
    .lg-cart-backdrop,
    .lg-cart-trigger,
    .lg-cart-count,
    .lg-cart-close { transition: none !important; animation: none !important; }
}

/* ----- TABLET (iPad) ----- */
@media (max-width: 1024px) {
    .lg-cart-trigger { width: 56px; height: 56px; bottom: 20px; }
    .lg-cart-icon { width: 24px; height: 24px; }
}

/* ----- MOBILE ----- */
@media (max-width: 600px) {
    .lg-cart-drawer { width: 100vw; }
    .lg-cart-trigger {
        width: 54px; height: 54px;
        bottom: 16px;
    }
    .lg-cart-header { padding: 18px 18px; }
    .lg-cart-title { font-size: 19px; }
    .lg-cart-body { padding: 12px 18px; }
    .lg-cart-footer { padding: 16px 18px 20px; padding-bottom: max(20px, env(safe-area-inset-bottom)); }
    .lg-cart-item { grid-template-columns: 60px 1fr auto; gap: 12px; }
    .lg-cart-item-image { width: 60px; height: 60px; }
    .lg-cart-totals-value { font-size: 22px; }
    .lg-cart-btn { padding: 13px 14px; font-size: 13px; }
}
