/* ============================================
   SQUIRCLE - CSS Progressiu
   Usa corner-shape: squircle on estigui suportat
   Fallback a border-radius normal
   ============================================ */

/* Variables per squircle */
:root {
    --squircle-sm: 8px;
    --squircle-md: 12px;
    --squircle-lg: 16px;
    --squircle-xl: 20px;
    --squircle-2xl: 24px;
}

/* Classe base squircle */
.squircle {
    border-radius: var(--squircle-lg);
}

/* Squircle amb CSS modern (progressiu) */
@supports (corner-shape: squircle) {
    .squircle,
    .product-card,
    .product-image img,
    .cart-item-image img,
    .btn,
    .filter-chip,
    .size-select,
    .quantity-control,
    .search-input,
    .order-confirmation,
    .order-confirm-details,
    .order-confirm-products,
    .modal-content,
    .ingredient-modal,
    .ingredient-chip {
        corner-shape: squircle;
    }
}

/* Aplicar border-radius als elements principals */
.product-card {
    border-radius: var(--squircle-xl);
}

.product-image img {
    border-radius: var(--squircle-lg) var(--squircle-lg) 0 0;
}

.cart-item-image img {
    border-radius: var(--squircle-md);
}

.btn,
.filter-chip {
    border-radius: var(--squircle-lg);
}

.size-select,
.quantity-control {
    border-radius: var(--squircle-md);
}

.search-input {
    border-radius: 50px; /* Aquest el mantenim rodó */
}


/* ============================================
   INGREDIENT MODIFICATIONS
   Sistema per treure ingredients de les pizzes
   ============================================ */

/* Botó per obrir modificacions */
/* Modal d'ingredients */
.ingredient-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 1rem;
}

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

.ingredient-modal {
    background: var(--white, #fff);
    border-radius: var(--squircle-xl);
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.ingredient-modal-overlay.active .ingredient-modal {
    transform: scale(1) translateY(0);
}

.ingredient-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--stone-200, #e7e5e4);
}

.ingredient-modal-header h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 1.25rem;
    color: var(--stone-900, #1c1917);
    margin: 0;
}

.ingredient-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--stone-100, #f5f5f4);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--stone-600, #57534e);
    transition: all 0.2s ease;
}

.ingredient-modal-close:hover {
    background: var(--stone-200, #e7e5e4);
    color: var(--stone-900, #1c1917);
}

.ingredient-modal-close svg {
    width: 18px;
    height: 18px;
}

.ingredient-modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 140px);
}

.ingredient-modal-subtitle {
    font-size: 0.875rem;
    color: var(--stone-500, #78716c);
    margin: 0 0 1rem 0;
}

/* Llista d'ingredients */
.ingredient-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ingredient-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--stone-50, #fafaf9);
    border-radius: var(--squircle-md);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.ingredient-item:hover {
    background: var(--stone-100, #f5f5f4);
}

.ingredient-item.removed {
    background: #FEF2F2;
    text-decoration: line-through;
    color: var(--stone-400, #a8a29e);
}

.ingredient-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--stone-300, #d6d3d1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.ingredient-item:not(.removed) .ingredient-checkbox {
    background: var(--terracotta-500, #E64A19);
    border-color: var(--terracotta-500, #E64A19);
}

.ingredient-item:not(.removed) .ingredient-checkbox::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-bottom: 2px;
}

.ingredient-item.removed .ingredient-checkbox {
    background: transparent;
    border-color: var(--stone-300, #d6d3d1);
}

.ingredient-name {
    font-size: 0.9375rem;
    color: var(--stone-700, #44403c);
    flex: 1;
}

.ingredient-item.removed .ingredient-name {
    color: var(--stone-400, #a8a29e);
}

/* Footer del modal */
.ingredient-modal-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--stone-200, #e7e5e4);
    background: var(--stone-50, #fafaf9);
}

.btn-ingredient-cancel,
.btn-ingredient-confirm {
    flex: 1;
    padding: 0.875rem;
    border-radius: var(--squircle-md);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-ingredient-cancel {
    background: var(--stone-200, #e7e5e4);
    color: var(--stone-700, #44403c);
}

.btn-ingredient-cancel:hover {
    background: var(--stone-300, #d6d3d1);
}

.btn-ingredient-confirm {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    background: var(--terracotta-500, #E64A19);
    color: white;
}

.btn-ingredient-confirm:hover {
    background: var(--terracotta-600, #D84315);
}

/* Secció de quantitat al modal */
.ingredient-quantity-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--stone-200, #e7e5e4);
}

.ingredient-quantity-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--stone-700, #44403c);
    margin-bottom: 0.75rem;
}

.ingredient-quantity-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: var(--stone-100, #f5f5f4);
    border-radius: 12px;
    overflow: hidden;
    width: fit-content;
    margin: 0 auto;
}

.ingredient-quantity-control button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--stone-600, #57534e);
    font-size: 1.25rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.ingredient-quantity-control button:hover {
    background: var(--stone-200, #e7e5e4);
    color: var(--stone-900, #1c1917);
}

.ingredient-quantity-control button:active {
    transform: scale(0.95);
}

.ingredient-quantity-control span {
    min-width: 48px;
    text-align: center;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--stone-900, #1c1917);
}

.ingredient-quantity-hint {
    font-size: 0.75rem;
    color: var(--stone-500, #78716c);
    text-align: center;
    margin-top: 0.75rem;
    line-height: 1.4;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

/* Xips de modificacions al carret */
.cart-item-modifications {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-top: 0.5rem;
}

.modification-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: #FEF2F2;
    border-radius: var(--squircle-sm);
    font-size: 0.6875rem;
    color: #B91C1C;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.modification-chip svg {
    width: 10px;
    height: 10px;
}

/* ============================================
   CART ITEM - NOVA UI
   ============================================ */

.cart-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.875rem;
    background: var(--white, #fff);
    border-radius: var(--squircle-lg);
    border: 1px solid var(--stone-100, #f5f5f4);
    margin-bottom: 0.5rem;
    transition: all 0.2s ease;
}

.cart-item:hover {
    border-color: var(--stone-200, #e7e5e4);
}

.cart-item.has-mods {
    border-color: rgba(185, 28, 28, 0.2);
    background: linear-gradient(to right, #FEF2F2 0%, var(--white) 30%);
}

.cart-item-image {
    width: 56px;
    height: 56px;
    flex-shrink: 0;
}

.cart-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--squircle-md);
}

.cart-item-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.cart-item-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cart-item-name {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--stone-900, #1c1917);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-item-size {
    flex-shrink: 0;
    padding: 0.125rem 0.375rem;
    background: var(--stone-100, #f5f5f4);
    border-radius: 4px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--stone-600, #57534e);
    text-transform: uppercase;
}

.cart-item-edit {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px dashed var(--stone-300, #d6d3d1);
    border-radius: 6px;
    cursor: pointer;
    color: var(--stone-400, #a8a29e);
    transition: all 0.2s ease;
    padding: 0;
    margin-left: auto;
}

.cart-item-edit:hover {
    border-color: var(--terracotta-400, #FF7043);
    border-style: solid;
    color: var(--terracotta-500, #E64A19);
    background: rgba(230, 74, 25, 0.05);
}

.cart-item-edit svg {
    width: 12px;
    height: 12px;
}

.cart-item-mods {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.125rem;
}

.mod-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.375rem;
    background: #FEE2E2;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 500;
    color: #991B1B;
    text-transform: lowercase;
}

.cart-item-price {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--terracotta-500, #E64A19);
    margin-top: auto;
}

.cart-item-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.5rem;
}

.cart-item-remove {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: var(--stone-400, #a8a29e);
    transition: all 0.2s ease;
    padding: 0;
}

.cart-item-remove:hover {
    background: #FEE2E2;
    color: #DC2626;
}

.cart-item-remove svg {
    width: 14px;
    height: 14px;
}

.cart-item-quantity {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--stone-100, #f5f5f4);
    border-radius: var(--squircle-sm);
    overflow: hidden;
}

.cart-item-quantity button {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--stone-600, #57534e);
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.cart-item-quantity button:hover {
    background: var(--stone-200, #e7e5e4);
    color: var(--stone-900, #1c1917);
}

.cart-item-quantity button:active {
    transform: scale(0.95);
}

.cart-item-quantity span {
    min-width: 24px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--stone-900, #1c1917);
}

/* Modal size badge */
.modal-size-badge {
    display: inline-flex;
    padding: 0.25rem 0.5rem;
    background: var(--terracotta-100, #FFCCBC);
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--terracotta-700, #BF360C);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-left: 0.5rem;
    vertical-align: middle;
}

/* Botó modificar - compacte, dins de add-to-cart */
.btn-modify-ingredients {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    background: transparent;
    border: 1px dashed var(--stone-300, #d6d3d1);
    border-radius: 8px;
    color: var(--stone-500, #78716c);
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    margin-top: -2px; /* Centrar verticalment */
}

.btn-modify-ingredients:hover {
    border-color: var(--terracotta-400, #FF7043);
    border-style: solid;
    color: var(--terracotta-500, #E64A19);
    background: rgba(230, 74, 25, 0.05);
}

.btn-modify-ingredients svg {
    width: 12px;
    height: 12px;
}

.btn-modify-ingredients .mod-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 15px;
    height: 15px;
    background: var(--terracotta-500, #E64A19);
    border-radius: 8px;
    font-size: 0.6rem;
    font-weight: 600;
    color: white;
}

.btn-modify-ingredients.has-modifications {
    border-style: solid;
    border-color: var(--terracotta-400, #FF7043);
    color: var(--terracotta-600, #D84315);
    background: rgba(230, 74, 25, 0.08);
}

/* Responsive */
@media (max-width: 480px) {
    .ingredient-modal {
        max-height: 90vh;
        border-radius: var(--squircle-xl) var(--squircle-xl) 0 0;
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        max-width: 100%;
    }
    
    .ingredient-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }
    
    .ingredient-modal-body {
        max-height: calc(90vh - 140px);
    }
}

/* ============================================
   APLICAR SQUIRCLE A COMPONENTS EXISTENTS
   ============================================ */

@supports (corner-shape: squircle) {
    .order-confirmation,
    .order-confirm-details,
    .order-confirm-products,
    .order-confirm-limit,
    .btn-modify-order,
    .btn-cancel-order,
    .btn-back,
    .btn-confirm-cancel,
    .btn-confirm-sent,
    .cart-item,
    .checkout-form input,
    .checkout-form select,
    .checkout-form textarea {
        corner-shape: squircle;
    }
}

.order-confirmation {
    border-radius: var(--squircle-xl);
}

.order-confirm-details,
.order-confirm-products {
    border-radius: var(--squircle-lg);
}

.cart-item {
    border-radius: var(--squircle-lg);
}

.checkout-form input,
.checkout-form select,
.checkout-form textarea {
    border-radius: var(--squircle-md);
}