/**
 * Arif Shopping Cart - Mobile Styles
 * Full-screen slide-in cart overlay from right side
 */

/* ==========================================================================
   CART CONTAINER
   ========================================================================== */

.arif-shoppingcart {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    pointer-events: none;
    visibility: hidden;
    font-family: 'Poppins', sans-serif;
}

.arif-shoppingcart.is-open {
    pointer-events: auto !important;
    visibility: visible !important;
}

/* ==========================================================================
   OVERLAY
   ========================================================================== */

.arif-shoppingcart-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.arif-shoppingcart.is-open .arif-shoppingcart-overlay {
    opacity: 1;
}

.arif-shoppingcart.is-closing .arif-shoppingcart-overlay {
    opacity: 0;
}

/* ==========================================================================
   PANEL (slides from RIGHT)
   ========================================================================== */

.arif-shoppingcart-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 100%;
    height: 100%;
    background: #f8f8f8;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.arif-shoppingcart.is-open .arif-shoppingcart-panel {
    transform: translateX(0);
}

.arif-shoppingcart.is-closing .arif-shoppingcart-panel {
    transform: translateX(100%);
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.arif-shoppingcart-header {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    min-height: 60px;
    flex-shrink: 0;
    background: #fff;
}

.arif-shoppingcart-title {
    flex: 1;
    font-family: 'Oswald', sans-serif;
    font-size: 18px;
    font-weight: 500;
    text-transform: uppercase;
    text-align: center;
    margin: 0;
    padding-right: 36px;
}

.arif-shoppingcart-close {
    background: none;
    border: none;
    font-size: 36px;
    font-weight: 200;
    padding: 5px;
    cursor: pointer;
    color: #333;
    transition: color 0.2s ease;
    line-height: 1;
}

/* ==========================================================================
   CONTENT
   ========================================================================== */

.arif-shoppingcart-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ==========================================================================
   SKELETON LOADER
   ========================================================================== */

.arif-shoppingcart-loading {
    padding: 15px;
}

.arif-shoppingcart-loading .skeleton-item {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.arif-shoppingcart-loading .skeleton-item::before {
    content: '';
    width: 70px;
    height: 70px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    flex-shrink: 0;
}

.arif-shoppingcart-loading .skeleton-item::after {
    content: '';
    flex: 1;
    height: 50px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.arif-shoppingcart.is-open .arif-shoppingcart-loading {
    display: block;
}

.arif-shoppingcart.is-open.loaded .arif-shoppingcart-loading {
    display: none;
}

/* ==========================================================================
   PRODUCTS LIST
   ========================================================================== */

.arif-shoppingcart-products {
    display: none;
}

.arif-shoppingcart.loaded .arif-shoppingcart-products {
    display: block;
}

.cart-product {
    display: flex;
    gap: 12px;
    padding: 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.cart-product img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    border-radius: 4px;
    flex-shrink: 0;
}

.cart-product .product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cart-product .product-name {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    text-decoration: none;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.cart-product .product-attrs {
    font-size: 12px;
    color: #666;
    margin-bottom: 4px;
}

.cart-product .product-price {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.cart-product .product-attrs .attr-group {
    color: #999;
    font-size: 11px;
}

.cart-product .product-unit-price {
    display: block;
    font-size: 11px;
    color: #999;
    font-weight: normal;
}

/* ==========================================================================
   PRODUCT ACTIONS (quantity & remove)
   ========================================================================== */

.cart-product .product-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    flex-shrink: 0;
}

.quantity-control {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.quantity-control button {
    width: 32px;
    height: 32px;
    background: #f5f5f5;
    border: none;
    font-size: 18px;
    font-weight: 500;
    cursor: pointer;
    color: #333;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quantity-control button:active {
    background: #e0e0e0;
}

.quantity-control .qty-input {
    width: 40px;
    height: 32px;
    text-align: center;
    border: none;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
    font-size: 14px;
    font-weight: 500;
    -moz-appearance: textfield;
}

.quantity-control .qty-input::-webkit-outer-spin-button,
.quantity-control .qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.remove-product {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    padding: 5px;
    font-size: 16px;
    transition: color 0.2s ease;
}

.remove-product:hover,
.remove-product:active {
    color: #e74c3c;
}

/* ==========================================================================
   EMPTY CART
   ========================================================================== */

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

/* ==========================================================================
   INFO SECTION (moneybox & free delivery)
   ========================================================================== */

.arif-shoppingcart-info {
    padding: 12px 15px;
    background: #fff;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

.arif-shoppingcart-info .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.arif-shoppingcart-info .info-row:not(:last-child) {
    border-bottom: 1px solid #f0f0f0;
}

.arif-shoppingcart-info .info-label {
    font-size: 13px;
    color: #666;
}

.arif-shoppingcart-info .info-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #333;
}

.arif-shoppingcart-info .diamond-icon,
.arif-shoppingcart-info .delivery-icon {
    width: 18px;
    height: 18px;
}

.arif-shoppingcart-info .info-moneybox .info-value {
    color: #46a74e;
}

.arif-shoppingcart-info .info-delivery-free {
    color: #46a74e;
    font-weight: 600;
}

.arif-shoppingcart-info .info-delivery-free .delivery-icon {
    margin-left: auto;
}

.arif-shoppingcart-info .info-delivery-remaining .info-value {
    color: #185df8;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.arif-shoppingcart-footer {
    flex-shrink: 0;
    border-top: 1px solid #ddd;
    background: #fff;
    padding: 15px 20px;
    padding-bottom: calc(15px + env(safe-area-inset-bottom, 0px));
}

.arif-shoppingcart-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.arif-shoppingcart-summary .summary-label {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.arif-shoppingcart-summary .summary-total {
    font-size: 20px;
    font-weight: 700;
    color: #333;
}

.arif-shoppingcart-checkout {
    display: block;
    width: 100%;
    padding: 14px 20px;
    background: #FF5A00;
    color: #fff;
    text-align: center;
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    transition: background 0.2s ease;
}

.arif-shoppingcart-checkout:hover {
    background: #e65000;
    color: #fff;
}

/* ==========================================================================
   LOADING STATE ON ACTIONS
   ========================================================================== */

.cart-product.updating {
    opacity: 0.5;
    pointer-events: none;
}

/* Blocked products (not being edited) during quantity update */
.cart-product.blocked {
    opacity: 0.5;
    pointer-events: none;
}

.cart-product.blocked .quantity-control button,
.cart-product.blocked .qty-input,
.cart-product.blocked .remove-product {
    cursor: not-allowed;
}

/* ==========================================================================
   BODY STATE (prevent scroll when cart is open)
   ========================================================================== */

html.arif-shoppingcart-open,
body.arif-shoppingcart-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   HIDE MOBILE NAV WHEN CART IS OPEN
   ========================================================================== */

html.arif-shoppingcart-open .arif-mobilenav {
    display: none !important;
}

/* ==========================================================================
   PRODUCT ADDED MODAL (slides up from BOTTOM)
   ========================================================================== */

.arif-product-added {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999998 !important;
    pointer-events: none;
    visibility: hidden;
    font-family: 'Poppins', sans-serif;
}

.arif-product-added.is-open {
    pointer-events: auto !important;
    visibility: visible !important;
}

/* Overlay */
.arif-product-added-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.arif-product-added.is-open .arif-product-added-overlay {
    opacity: 1;
}

.arif-product-added.is-closing .arif-product-added-overlay {
    opacity: 0;
}

/* Panel (slides UP from BOTTOM) */
.arif-product-added-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.arif-product-added.is-open .arif-product-added-panel {
    transform: translateY(0);
}

.arif-product-added.is-closing .arif-product-added-panel {
    transform: translateY(100%);
}

/* Header */
.arif-product-added-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #46a74e;
}

.arif-product-added-title {
    font-family: 'Oswald', sans-serif;
    font-size: 15px;
    font-weight: 500;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
}

.arif-product-added-close {
    background: none;
    border: none;
    font-size: 28px;
    font-weight: 200;
    padding: 0;
    cursor: pointer;
    color: #fff;
    line-height: 1;
}

/* Content - Product Info */
.arif-product-added-content {
    display: flex;
    gap: 15px;
    padding: 20px;
    align-items: flex-start;
}

.product-added-image {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
}

.product-added-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.product-added-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.product-added-name {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.product-added-attrs {
    font-size: 13px;
    color: #666;
}

.product-added-attrs:empty {
    display: none;
}

.product-added-price {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-top: 4px;
}

/* Delivery Info */
.arif-product-added-delivery {
    padding: 12px 20px;
    background: #f8f8f8;
    border-top: 1px solid #eee;
}

.arif-product-added-delivery .delivery-free,
.arif-product-added-delivery .delivery-remaining {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.arif-product-added-delivery .delivery-free {
    color: #46a74e;
    font-weight: 600;
}

.arif-product-added-delivery .delivery-remaining {
    color: #333;
}

.arif-product-added-delivery .delivery-remaining strong {
    color: #185df8;
    margin-left: auto;
}

.arif-product-added-delivery .delivery-icon {
    width: 24px;
    height: 24px;
}

/* Footer - Buttons */
.arif-product-added-footer {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid #eee;
}

.arif-product-added-footer button {
    flex: 1;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    border: none;
    transition: background 0.2s ease;
}

.arif-product-added-footer .btn-continue {
    background: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

.arif-product-added-footer .btn-continue:active {
    background: #e8e8e8;
}

.arif-product-added-footer .btn-cart {
    background: #FF5A00;
    color: #fff;
}

.arif-product-added-footer .btn-cart:active {
    background: #e65000;
}

/* Body state */
html.arif-product-added-open,
body.arif-product-added-open {
    overflow: hidden !important;
}

/* ==========================================================================
   DESKTOP: HIDE MOBILE-ONLY ELEMENTS
   ========================================================================== */

@media (min-width: 992px) {
    /* Side cart widoczny na desktop z węższym panelem */
    .arif-shoppingcart-panel {
        max-width: 420px;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Ukryj tylko modal "Produkt dodany" na desktop */
    .arif-product-added {
        display: none !important;
    }
}
