/**
 * Cart Panel Styles
 * Shared styles for the cart UI across all JouwPrivacy sites
 */

/* ============================================
   Cart Icon in Navbar
   ============================================ */

.cart-nav-item {
    position: relative;
}

.cart-icon-link,
.cart-nav-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.cart-icon-link:hover,
.cart-nav-link:hover {
    opacity: 0.8;
}

.cart-icon-link .material-icons,
.cart-nav-link .material-icons {
    font-size: 24px;
}

.cart-badge {
    position: absolute;
    bottom: 12px;
    right: 4px;
    background: #165df5;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cart-badge-pop {
    animation: badge-pop 0.3s ease;
}

@keyframes badge-pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* ============================================
   Cart Panel (Slide-in from right)
   ============================================ */

.cart-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    max-width: 100vw;
    height: 100vh;
    background: #1a1a1a;
    z-index: 10001;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cart-panel.open {
    right: 0;
}

/* Header */
.cart-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #333;
    flex-shrink: 0;
}

.cart-panel-header h3 {
    color: #fff;
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.cart-panel-close {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s ease;
}

.cart-panel-close:hover {
    color: #fff;
}

/* Content area (scrollable) */
.cart-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* Items container */
.cart-panel-items {
    padding: 15px 20px;
}

.cart-empty {
    color: #666;
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
}

/* Individual cart item */
.cart-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto;
    gap: 12px;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid #2a2a2a;
}

.cart-item:last-child {
    border-bottom: none;
}

.cart-item-info {
    min-width: 0;
}

.cart-item-info h4 {
    color: #fff;
    margin: 0 0 4px 0;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-description {
    color: #666;
    font-size: 12px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-option {
    display: inline-block;
    background: #2a2a2a;
    color: #888;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 4px;
}

/* Quantity controls */
.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 6px;
}

.qty-btn {
    width: 26px;
    height: 26px;
    border: 1px solid #444;
    background: #2a2a2a;
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.qty-btn:hover {
    background: #3a3a3a;
}

.qty-value {
    color: #fff;
    font-size: 14px;
    min-width: 20px;
    text-align: center;
}

/* Price */
.cart-item-price {
    text-align: right;
    min-width: 70px;
}

.original-price {
    text-decoration: line-through;
    color: #666;
    font-size: 11px;
    display: block;
}

.current-price {
    color: #165df5;
    font-weight: 600;
    font-size: 14px;
}

/* Remove button */
.cart-item-remove {
    background: none;
    border: none;
    color: #666;
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s ease;
}

.cart-item-remove:hover {
    color: #e74c3c;
}

/* ============================================
   Upsells Section
   ============================================ */

.cart-panel-upsells {
    background: #222;
    border-top: 1px solid #333;
}

.cart-upsells-header {
    padding: 15px 20px 10px;
}

.cart-upsells-header h4 {
    color: #165df5;
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.cart-upsell-items {
    padding: 0 20px 15px;
}

.cart-upsell-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #2a2a2a;
}

.cart-upsell-item:last-child {
    border-bottom: none;
}

.upsell-info {
    flex: 1;
    min-width: 0;
}

.upsell-info strong {
    color: #fff;
    display: block;
    font-size: 13px;
    font-weight: 500;
}

.upsell-description {
    color: #666;
    font-size: 11px;
    display: block;
    margin-top: 2px;
}

.upsell-price {
    color: #165df5;
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
    display: block;
}

.upsell-add-btn {
    background: #165df5;
    color: #fff;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.2s ease;
    white-space: nowrap;
    margin-left: 12px;
}

.upsell-add-btn:hover {
    background: #1470ff;
}

/* ============================================
   Footer (Fixed at bottom)
   ============================================ */

.cart-panel-footer {
    border-top: 1px solid #333;
    flex-shrink: 0;
    background: #1a1a1a;
}

/* Totals */
.cart-panel-totals {
    padding: 15px 20px;
}

.cart-subtotal,
.cart-discount,
.cart-total {
    display: flex;
    justify-content: space-between;
    color: #fff;
    padding: 4px 0;
    font-size: 14px;
}

.cart-discount span:last-child {
    color: #165df5;
}

.cart-total {
    font-size: 16px;
    font-weight: 600;
    border-top: 1px solid #333;
    margin-top: 8px;
    padding-top: 12px;
}

/* Checkout button */
.cart-panel-actions {
    padding: 0 20px 20px;
}

.cart-checkout-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: #165df5;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    border-radius: 8px;
    transition: background 0.2s ease;
}

.cart-checkout-btn:hover {
    background: #1e6fff;
    color: #fff;
}

/* ============================================
   Overlay
   ============================================ */

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.cart-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Prevent body scroll when cart is open */
body.cart-panel-open {
    overflow: hidden;
}

/* ============================================
   Toast Notification
   ============================================ */

.cart-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #165df5;
    color: #fff;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    z-index: 10002;
    opacity: 0;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.cart-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   Mobile Responsiveness
   ============================================ */

@media (max-width: 480px) {
    .cart-panel {
        width: 100%;
        right: -100%;
    }

    .cart-item {
        grid-template-columns: 1fr auto auto;
        gap: 8px;
    }

    .cart-item-info h4 {
        font-size: 13px;
    }

    .cart-item-price {
        min-width: 60px;
    }

    .current-price {
        font-size: 13px;
    }
}

@media (max-width: 360px) {
    .cart-panel-header,
    .cart-panel-items,
    .cart-upsells-header,
    .cart-upsell-items,
    .cart-panel-totals,
    .cart-panel-actions {
        padding-left: 15px;
        padding-right: 15px;
    }
}
