/* Sepet Styles - Fixed Overflow Issues */
.cart-sidebar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100vw;
    max-width: 400px;
    height: 100vh;
    height: 100dvh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s ease;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}

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

.cart-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cart-overlay.open {
    display: block;
    opacity: 1;
}

.cart-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    flex-shrink: 0;
    min-height: 60px;
    box-sizing: border-box;
}

.cart-header h2 {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.2;
}

.close-cart {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 5px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cart-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    min-height: 0;
}

.cart-item {
    display: flex;
    gap: 15px;
    padding: 15px;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 15px;
    background: #fafafa;
    box-sizing: border-box;
    max-width: 100%;
}

.cart-item-image {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 5px;
    flex-shrink: 0;
}

.cart-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.cart-item-info strong {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    word-break: break-word;
    line-height: 1.3;
}

.cart-item-info small {
    display: block;
    color: #666;
    margin-bottom: 2px;
    font-size: 0.8rem;
    line-height: 1.3;
}

.cart-item-actions {
    display: flex;
    align-items: flex-start;
    flex-shrink: 0;
}

.btn-remove {
    color: #dc3545;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 12px;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    white-space: nowrap;
}

.cart-footer {
    padding: 20px;
    border-top: 1px solid #eee;
    background: #f8f9fa;
    flex-shrink: 0;
    box-sizing: border-box;
}

.cart-total {
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    margin-bottom: 15px;
    color: #007bff;
    line-height: 1.2;
    word-break: break-word;
}

.cart-empty {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    box-sizing: border-box;
}

.cart-empty p {
    margin: 0;
    line-height: 1.4;
}

.btn-logout {
    background: #6c757d;
    color: white;
    padding: 12px;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    display: block;
    text-align: center;
    width: 100%;
    font-size: 1rem;
    min-height: 44px;
    cursor: pointer;
    box-sizing: border-box;
    line-height: 1.2;
}

.btn-logout:hover {
    background: #545b62;
    color: white;
}

/* Mobile Styles - Fixed Overflow */
@media (max-width: 768px) {
    .cart-sidebar {
        width: 100vw;
        max-width: 100vw;
        right: -100vw;
    }
    
    .cart-header {
        padding: 15px;
        min-height: 55px;
    }
    
    .cart-header h2 {
        font-size: 1.2rem;
    }
    
    .cart-content {
        padding: 15px;
    }
    
    .cart-item {
        padding: 12px;
        gap: 12px;
        margin-bottom: 12px;
    }
    
    .cart-item-image {
        width: 50px;
        height: 50px;
    }
    
    .cart-footer {
        padding: 15px;
    }
    
    .cart-total {
        font-size: 1.2rem;
    }
}

@media (max-width: 576px) {
    .cart-sidebar {
        width: 100vw;
    }
    
    .cart-header {
        padding: 12px 15px;
        min-height: 50px;
    }
    
    .cart-content {
        padding: 10px 15px;
    }
    
    .cart-item {
        padding: 10px;
        gap: 10px;
        margin-bottom: 10px;
    }
    
    .cart-item-image {
        width: 45px;
        height: 45px;
    }
    
    .cart-footer {
        padding: 15px;
    }
    
    /* Force full width on very small screens */
    .cart-item {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .cart-header {
        padding: 10px 12px;
    }
    
    .cart-content {
        padding: 8px 12px;
    }
    
    .cart-item {
        padding: 8px;
        gap: 8px;
    }
    
    .cart-item-info strong {
        font-size: 0.85rem;
    }
    
    .cart-item-info small {
        font-size: 0.75rem;
    }
    
    .btn-remove {
        padding: 6px 10px;
        font-size: 0.9rem;
    }
}

/* Prevent horizontal scroll */
body.cart-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

/* Ensure no overflow in cart content */
.cart-content::-webkit-scrollbar {
    width: 4px;
}

.cart-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cart-content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

/* Fix for iOS Safari */
@supports (-webkit-touch-callout: none) {
    .cart-sidebar {
        height: -webkit-fill-available;
    }
}

/* Safe area insets for modern devices */
@supports(padding: max(0px)) {
    .cart-sidebar {
        padding-right: max(0px, env(safe-area-inset-right));
        padding-left: max(0px, env(safe-area-inset-left));
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
    
    .cart-header {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    .cart-content {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
    }
    
    .cart-footer {
        padding-left: max(15px, env(safe-area-inset-left));
        padding-right: max(15px, env(safe-area-inset-right));
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }
}